diff --git a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMDirectConnectModule.cs b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMDirectConnectModule.cs index 53fd576..dd7b6b3 100644 --- a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMDirectConnectModule.cs +++ b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMDirectConnectModule.cs @@ -92,7 +92,12 @@ public class LRMDirectConnectModule : MonoBehaviour { if (showDebugLogs) Debug.Log("Kicked direct connect client."); +#if MIRROR_37_0_OR_NEWER + directConnectTransport.ServerDisconnect(clientID); + return true; +#else return directConnectTransport.ServerDisconnect(clientID); +#endif } public void ClientDisconnect() @@ -110,7 +115,7 @@ public class LRMDirectConnectModule : MonoBehaviour directConnectTransport.ClientSend(channel, data); } - #region Transport Callbacks +#region Transport Callbacks void OnServerConnected(int clientID) { if (showDebugLogs) @@ -157,5 +162,5 @@ public class LRMDirectConnectModule : MonoBehaviour if (showDebugLogs) Debug.Log("Direct Client Error: " + error); } - #endregion +#endregion } \ No newline at end of file diff --git a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportOverrides.cs b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportOverrides.cs index 2ef59bd..aa2ed65 100644 --- a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportOverrides.cs +++ b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportOverrides.cs @@ -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) { if (_connectedRelayClients.TryGetBySecond(connectionId, out int relayId)) @@ -151,6 +166,7 @@ namespace LightReflectiveMirror return false; } +#endif public override void ServerSend(int connectionId, int channelId, ArraySegment segment) {