Removed scene management and reworked netConfig comparison

This commit is contained in:
Albin Corén 2018-01-07 05:51:13 +01:00
parent dbc6ac1370
commit 0a6e22c95e
2 changed files with 11 additions and 8 deletions

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using UnityEngine;
using UnityEngine.Networking; using UnityEngine.Networking;
namespace MLAPI namespace MLAPI
@ -69,7 +68,17 @@ namespace MLAPI
public bool CompareConfig(byte[] hash) public bool CompareConfig(byte[] hash)
{ {
return hash.SequenceEqual(GetConfig()); byte[] localConfigHash = GetConfig();
if (hash.Length != localConfigHash.Length)
return false;
for (int i = 0; i < hash.Length; i++)
{
if (hash[i] != localConfigHash[i])
return false;
}
return true;
} }
} }
} }

View File

@ -2,10 +2,8 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.Networking; using UnityEngine.Networking;
using UnityEngine.SceneManagement;
namespace MLAPI namespace MLAPI
{ {
@ -42,8 +40,6 @@ namespace MLAPI
private Dictionary<ushort, int> messageHandlerCounter; private Dictionary<ushort, int> messageHandlerCounter;
private Dictionary<ushort, Stack<int>> releasedMessageHandlerCounters; private Dictionary<ushort, Stack<int>> releasedMessageHandlerCounters;
internal int serverClientId; internal int serverClientId;
public int PlaySceneIndex;
public int MenuSceneIndex;
internal Dictionary<uint, NetworkedObject> spawnedObjects; internal Dictionary<uint, NetworkedObject> spawnedObjects;
public Dictionary<uint, NetworkedObject> SpawnedObjects public Dictionary<uint, NetworkedObject> SpawnedObjects
{ {
@ -263,7 +259,6 @@ namespace MLAPI
public void StartServer(NetworkingConfiguration netConfig) public void StartServer(NetworkingConfiguration netConfig)
{ {
SceneManager.LoadScene(PlaySceneIndex);
ConnectionConfig cConfig = Init(netConfig); ConnectionConfig cConfig = Init(netConfig);
if (NetworkConfig.ConnectionApproval) if (NetworkConfig.ConnectionApproval)
{ {
@ -293,7 +288,6 @@ namespace MLAPI
public void StartHost(NetworkingConfiguration netConfig) public void StartHost(NetworkingConfiguration netConfig)
{ {
SceneManager.LoadScene(PlaySceneIndex);
ConnectionConfig cConfig = Init(netConfig); ConnectionConfig cConfig = Init(netConfig);
if (NetworkConfig.ConnectionApproval) if (NetworkConfig.ConnectionApproval)
{ {