From 0a6e22c95e1bc178d7befab0c261f671a0017703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Cor=C3=A9n?= <2108U9@gmail.com> Date: Sun, 7 Jan 2018 05:51:13 +0100 Subject: [PATCH] Removed scene management and reworked netConfig comparison --- MLAPI/Data/NetworkingConfiguration.cs | 13 +++++++++++-- MLAPI/MonoBehaviours/Core/NetworkingManager.cs | 6 ------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/MLAPI/Data/NetworkingConfiguration.cs b/MLAPI/Data/NetworkingConfiguration.cs index 6798369..3dab9c5 100644 --- a/MLAPI/Data/NetworkingConfiguration.cs +++ b/MLAPI/Data/NetworkingConfiguration.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography; -using UnityEngine; using UnityEngine.Networking; namespace MLAPI @@ -69,7 +68,17 @@ namespace MLAPI 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; } } } diff --git a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs index c8c4fd5..a093eca 100644 --- a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs +++ b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs @@ -2,10 +2,8 @@ using System.Collections; using System.Collections.Generic; using System.IO; -using System.Linq; using UnityEngine; using UnityEngine.Networking; -using UnityEngine.SceneManagement; namespace MLAPI { @@ -42,8 +40,6 @@ namespace MLAPI private Dictionary messageHandlerCounter; private Dictionary> releasedMessageHandlerCounters; internal int serverClientId; - public int PlaySceneIndex; - public int MenuSceneIndex; internal Dictionary spawnedObjects; public Dictionary SpawnedObjects { @@ -263,7 +259,6 @@ namespace MLAPI public void StartServer(NetworkingConfiguration netConfig) { - SceneManager.LoadScene(PlaySceneIndex); ConnectionConfig cConfig = Init(netConfig); if (NetworkConfig.ConnectionApproval) { @@ -293,7 +288,6 @@ namespace MLAPI public void StartHost(NetworkingConfiguration netConfig) { - SceneManager.LoadScene(PlaySceneIndex); ConnectionConfig cConfig = Init(netConfig); if (NetworkConfig.ConnectionApproval) {