Support for mirror 37.0

This commit is contained in:
Derek S 2021-05-18 13:21:29 -05:00
parent c3558beade
commit 68ad564785
2 changed files with 23 additions and 2 deletions

View file

@ -92,7 +92,12 @@ public class LRMDirectConnectModule : MonoBehaviour
{ {
if (showDebugLogs) if (showDebugLogs)
Debug.Log("Kicked direct connect client."); Debug.Log("Kicked direct connect client.");
#if MIRROR_37_0_OR_NEWER
directConnectTransport.ServerDisconnect(clientID);
return true;
#else
return directConnectTransport.ServerDisconnect(clientID); return directConnectTransport.ServerDisconnect(clientID);
#endif
} }
public void ClientDisconnect() public void ClientDisconnect()

View file

@ -136,6 +136,21 @@ 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 (_connectedDirectClients.TryGetBySecond(connectionId, out int directId))
_directConnectModule.KickClient(directId);
}
#else
public override bool ServerDisconnect(int connectionId) public override bool ServerDisconnect(int connectionId)
{ {
if (_connectedRelayClients.TryGetBySecond(connectionId, out int relayId)) if (_connectedRelayClients.TryGetBySecond(connectionId, out int relayId))
@ -151,6 +166,7 @@ namespace LightReflectiveMirror
return false; return false;
} }
#endif
public override void ServerSend(int connectionId, int channelId, ArraySegment<byte> segment) public override void ServerSend(int connectionId, int channelId, ArraySegment<byte> segment)
{ {