Support for mirror 37.0
This commit is contained in:
parent
c3558beade
commit
68ad564785
2 changed files with 23 additions and 2 deletions
|
|
@ -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()
|
||||||
|
|
@ -110,7 +115,7 @@ public class LRMDirectConnectModule : MonoBehaviour
|
||||||
directConnectTransport.ClientSend(channel, data);
|
directConnectTransport.ClientSend(channel, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Transport Callbacks
|
#region Transport Callbacks
|
||||||
void OnServerConnected(int clientID)
|
void OnServerConnected(int clientID)
|
||||||
{
|
{
|
||||||
if (showDebugLogs)
|
if (showDebugLogs)
|
||||||
|
|
@ -157,5 +162,5 @@ public class LRMDirectConnectModule : MonoBehaviour
|
||||||
if (showDebugLogs)
|
if (showDebugLogs)
|
||||||
Debug.Log("Direct Client Error: " + error);
|
Debug.Log("Direct Client Error: " + error);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue