Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Gabriel Tofvesson 2018-04-10 20:27:06 +02:00
commit d6746064de
3 changed files with 19 additions and 2 deletions

View File

@ -3,10 +3,19 @@ using UnityEngine;
namespace MLAPI.Data namespace MLAPI.Data
{ {
/// <summary>
/// A class that represents a NetworkedPrefab
/// </summary>
[Serializable] [Serializable]
public class NetworkedPrefab public class NetworkedPrefab
{ {
/// <summary>
/// The name of the networked prefab
/// </summary>
public string name; public string name;
/// <summary>
/// The gameobject of the prefab
/// </summary>
public GameObject prefab; public GameObject prefab;
} }
} }

View File

@ -36,13 +36,13 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|AnyCPU'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\MLAPI-Examples\Assets\</OutputPath> <OutputPath>..\..\MLAPI-Examples\Assets\MLAPI\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<RunCodeAnalysis>false</RunCodeAnalysis> <RunCodeAnalysis>false</RunCodeAnalysis>
<DocumentationFile> <DocumentationFile>
</DocumentationFile> </DocumentationFile>

View File

@ -153,15 +153,20 @@ namespace MLAPI.MonoBehaviours.Core
private void OnValidate() private void OnValidate()
{ {
if (NetworkConfig == null)
return; //May occur when the component is added
if(NetworkConfig.EnableSceneSwitching && !NetworkConfig.RegisteredScenes.Contains(SceneManager.GetActiveScene().name)) if(NetworkConfig.EnableSceneSwitching && !NetworkConfig.RegisteredScenes.Contains(SceneManager.GetActiveScene().name))
{ {
Debug.LogWarning("MLAPI: The active scene is not registered as a networked scene. The MLAPI has added it"); Debug.LogWarning("MLAPI: The active scene is not registered as a networked scene. The MLAPI has added it");
NetworkConfig.RegisteredScenes.Add(SceneManager.GetActiveScene().name); NetworkConfig.RegisteredScenes.Add(SceneManager.GetActiveScene().name);
} }
if(!NetworkConfig.EnableSceneSwitching && NetworkConfig.HandleObjectSpawning) if(!NetworkConfig.EnableSceneSwitching && NetworkConfig.HandleObjectSpawning)
{ {
Debug.LogWarning("MLAPI: Please be aware that Scene objects are NOT supported if SceneManagement is turned on, even if HandleObjectSpawning is turned on"); Debug.LogWarning("MLAPI: Please be aware that Scene objects are NOT supported if SceneManagement is turned on, even if HandleObjectSpawning is turned on");
} }
if(NetworkConfig.HandleObjectSpawning) if(NetworkConfig.HandleObjectSpawning)
{ {
for (int i = 0; i < NetworkConfig.NetworkedPrefabs.Count; i++) for (int i = 0; i < NetworkConfig.NetworkedPrefabs.Count; i++)
@ -173,6 +178,7 @@ namespace MLAPI.MonoBehaviours.Core
} }
} }
} }
if (NetworkConfig.HandleObjectSpawning) if (NetworkConfig.HandleObjectSpawning)
{ {
if(!string.IsNullOrEmpty(NetworkConfig.PlayerPrefabName)) if(!string.IsNullOrEmpty(NetworkConfig.PlayerPrefabName))
@ -198,7 +204,9 @@ namespace MLAPI.MonoBehaviours.Core
} }
if (!NetworkConfig.EnableEncryption) if (!NetworkConfig.EnableEncryption)
{
RegenerateRSAKeys = false; RegenerateRSAKeys = false;
}
else else
{ {
if(RegenerateRSAKeys) if(RegenerateRSAKeys)