Skip to content

Commit 0a6e22c

Browse files
committed
Removed scene management and reworked netConfig comparison
1 parent dbc6ac1 commit 0a6e22c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

MLAPI/Data/NetworkingConfiguration.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.IO;
44
using System.Linq;
55
using System.Security.Cryptography;
6-
using UnityEngine;
76
using UnityEngine.Networking;
87

98
namespace MLAPI
@@ -69,7 +68,17 @@ public byte[] GetConfig(bool cache = true)
6968

7069
public bool CompareConfig(byte[] hash)
7170
{
72-
return hash.SequenceEqual(GetConfig());
71+
byte[] localConfigHash = GetConfig();
72+
73+
if (hash.Length != localConfigHash.Length)
74+
return false;
75+
76+
for (int i = 0; i < hash.Length; i++)
77+
{
78+
if (hash[i] != localConfigHash[i])
79+
return false;
80+
}
81+
return true;
7382
}
7483
}
7584
}

MLAPI/MonoBehaviours/Core/NetworkingManager.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.IO;
5-
using System.Linq;
65
using UnityEngine;
76
using UnityEngine.Networking;
8-
using UnityEngine.SceneManagement;
97

108
namespace MLAPI
119
{
@@ -42,8 +40,6 @@ internal bool isHost
4240
private Dictionary<ushort, int> messageHandlerCounter;
4341
private Dictionary<ushort, Stack<int>> releasedMessageHandlerCounters;
4442
internal int serverClientId;
45-
public int PlaySceneIndex;
46-
public int MenuSceneIndex;
4743
internal Dictionary<uint, NetworkedObject> spawnedObjects;
4844
public Dictionary<uint, NetworkedObject> SpawnedObjects
4945
{
@@ -263,7 +259,6 @@ private ConnectionConfig Init(NetworkingConfiguration netConfig)
263259

264260
public void StartServer(NetworkingConfiguration netConfig)
265261
{
266-
SceneManager.LoadScene(PlaySceneIndex);
267262
ConnectionConfig cConfig = Init(netConfig);
268263
if (NetworkConfig.ConnectionApproval)
269264
{
@@ -293,7 +288,6 @@ public void StartClient(NetworkingConfiguration netConfig)
293288

294289
public void StartHost(NetworkingConfiguration netConfig)
295290
{
296-
SceneManager.LoadScene(PlaySceneIndex);
297291
ConnectionConfig cConfig = Init(netConfig);
298292
if (NetworkConfig.ConnectionApproval)
299293
{

0 commit comments

Comments
 (0)