Flip define and add some logging

This commit is contained in:
cxxpxr 2021-07-08 07:32:58 -04:00
parent 37f3179aee
commit 68ad9ef8fe
4 changed files with 24 additions and 19 deletions

View file

@ -249,8 +249,9 @@ namespace LightReflectiveMirror.LoadBalancing
return true;
}
catch
catch (Exception e)
{
Logger.ForceLogMessage(e.ToString(), ConsoleColor.Red);
return false;
}
}

View file

@ -1238,7 +1238,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
clientToServerTransport: {fileID: 1521806211}
serverIP: localhost
serverIP: 68.174.160.78
serverPort: 7777
endpointServerPort: 8080
heartBeatInterval: 3
@ -1254,7 +1254,7 @@ MonoBehaviour:
loadBalancerAddress: 127.0.0.1
serverName: My awesome server!
extraServerData: Map 1
maxServerPlayers: 10
maxServerPlayers: 2
isPublicServer: 1
serverListUpdated:
m_PersistentCalls:

View file

@ -151,21 +151,8 @@ namespace LightReflectiveMirror
}
}
#if MIRROR_37_0_OR_NEWER
public override void ServerDisconnect(int connectionId)
{
if (_connectedRelayClients.TryGetBySecond(connectionId, out int relayId))
{
int pos = 0;
_clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.KickPlayer);
_clientSendBuffer.WriteInt(ref pos, relayId);
return;
}
#if !MIRROR_37_0_OR_NEWER
if (_connectedDirectClients.TryGetBySecond(connectionId, out int directId))
_directConnectModule.KickClient(directId);
}
#else
public override bool ServerDisconnect(int connectionId)
{
if (_connectedRelayClients.TryGetBySecond(connectionId, out int relayId))
@ -181,6 +168,23 @@ namespace LightReflectiveMirror
return false;
}
#else
public override void ServerDisconnect(int connectionId)
{
if (_connectedRelayClients.TryGetBySecond(connectionId, out int relayId))
{
int pos = 0;
_clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.KickPlayer);
_clientSendBuffer.WriteInt(ref pos, relayId);
return;
}
if (_connectedDirectClients.TryGetBySecond(connectionId, out int directId))
_directConnectModule.KickClient(directId);
}
#endif
#if MIRROR_40_0_OR_NEWER

View file

@ -204,7 +204,7 @@ namespace LightReflectiveMirror
case UnityWebRequest.Result.Success:
relayServerList?.Clear();
relayServerList = JsonUtilityHelper.FromJson<Room>(result.Decompress()).ToList();
relayServerList = JsonUtilityHelper.FromJson<Room>(result).ToList();
serverListUpdated?.Invoke();
_serverListUpdated = true;
break;
@ -217,7 +217,7 @@ namespace LightReflectiveMirror
else
{
relayServerList?.Clear();
relayServerList = JsonUtilityHelper.FromJson<Room>(result.Decompress()).ToList();
relayServerList = JsonUtilityHelper.FromJson<Room>(result).ToList();
serverListUpdated?.Invoke();
_serverListUpdated = true;
}