diff --git a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LightReflectiveMirrorTransport.cs b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LightReflectiveMirrorTransport.cs index 20af507..f92ad9f 100644 --- a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LightReflectiveMirrorTransport.cs +++ b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LightReflectiveMirrorTransport.cs @@ -21,6 +21,10 @@ namespace LightReflectiveMirror public bool IsAuthenticated() => _isAuthenticated; private void Awake() { +#if !NET_4_6 + throw new Exception("LRM | Please switch to .NET 4.x for LRM to function properly!"); +#endif + if (clientToServerTransport is LightReflectiveMirrorTransport) throw new Exception("Haha real funny... Use a different transport."); @@ -59,7 +63,6 @@ namespace LightReflectiveMirror _connectedToRelay = false; _isAuthenticated = false; diconnectedFromRelay?.Invoke(); - serverStatus = "Disconnected from relay."; } public void ConnectToRelay() @@ -99,10 +102,8 @@ namespace LightReflectiveMirror throw new Exception("LRM | Client to Server Transport cannot be LRM."); SetTransportPort(port); - this.serverIP = serverIP; - serverStatus = "Connecting to relay..."; _clientSendBuffer = new byte[clientToServerTransport.GetMaxPacketSize()]; clientToServerTransport.ClientConnect(serverIP); } @@ -151,11 +152,9 @@ namespace LightReflectiveMirror switch (opcode) { case OpCodes.Authenticated: - serverStatus = "Authenticated! Good to go!"; _isAuthenticated = true; break; case OpCodes.AuthenticationRequest: - serverStatus = "Sent authentication to relay..."; SendAuthKey(); break; case OpCodes.GetData: @@ -189,7 +188,7 @@ namespace LightReflectiveMirror } break; case OpCodes.RoomCreated: - serverId = data.ReadString(ref pos); + serverId = data.ReadInt(ref pos); break; case OpCodes.ServerJoined: int clientId = data.ReadInt(ref pos); @@ -262,7 +261,7 @@ namespace LightReflectiveMirror if (!IPAddress.TryParse(serverIP, out serverAddr)) serverAddr = Dns.GetHostEntry(serverIP).AddressList[0]; - _relayPuncherIP = new IPEndPoint(serverAddr, NATPunchtroughPort); + _relayPuncherIP = new IPEndPoint(IPAddress.Parse(serverIP), NATPunchtroughPort); // Send 3 to lower chance of it being dropped or corrupted when received on server. _NATPuncher.Send(initalData, sendPos, _relayPuncherIP); @@ -332,7 +331,7 @@ namespace LightReflectiveMirror } } - Room GetServerForID(string serverID) + Room GetServerForID(int serverID) { for(int i = 0; i < relayServerList.Count; i++) { @@ -340,7 +339,6 @@ namespace LightReflectiveMirror return relayServerList[i]; } - OnClientDisconnected?.Invoke(); throw new Exception("LRM | An attempt was made to connect to a server which does not exist!"); } @@ -379,7 +377,7 @@ namespace LightReflectiveMirror { public string serverName; public int maxPlayers; - public string serverId; + public int serverId; public string serverData; public int hostId; public List clients;