diff --git a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMDirectConnectModule.cs b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMDirectConnectModule.cs index dd7b6b38..35d0a5bb 100644 --- a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMDirectConnectModule.cs +++ b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMDirectConnectModule.cs @@ -107,12 +107,20 @@ public void ClientDisconnect() public void ServerSend(int clientID, ArraySegment data, int channel) { +#if MIRROR_40_0_OR_NEWER + directConnectTransport.ServerSend(clientID, data, channel); +#else directConnectTransport.ServerSend(clientID, channel, data); +#endif } public void ClientSend(ArraySegment data, int channel) { +#if MIRROR_40_0_OR_NEWER + directConnectTransport.ClientSend(data, channel); +#else directConnectTransport.ClientSend(channel, data); +#endif } #region Transport Callbacks diff --git a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportDirectConnect.cs b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportDirectConnect.cs index a2ce6e31..b9a962f3 100644 --- a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportDirectConnect.cs +++ b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportDirectConnect.cs @@ -57,7 +57,11 @@ public void DirectDisconnected() _isClient = true; +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new System.ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new System.ArraySegment(_clientSendBuffer, 0, pos)); +#endif } if (_clientProxy != null) diff --git a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportOverrides.cs b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportOverrides.cs index aa2ed656..1b5b57e0 100644 --- a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportOverrides.cs +++ b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportOverrides.cs @@ -93,8 +93,11 @@ public override void ClientConnect(string address) } _isClient = true; - +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new System.ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new System.ArraySegment(_clientSendBuffer, 0, pos)); +#endif } else @@ -112,14 +115,23 @@ public override void ClientDisconnect() { int pos = 0; _clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.LeaveRoom); +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } if (_directConnectModule != null) _directConnectModule.ClientDisconnect(); } +#if MIRROR_40_0_OR_NEWER + public override void ClientSend(ArraySegment segment, int channelId) +#else public override void ClientSend(int channelId, ArraySegment segment) + +#endif { if (_directConnected) { @@ -131,8 +143,11 @@ public override void ClientSend(int channelId, ArraySegment segment) _clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.SendData); _clientSendBuffer.WriteBytes(ref pos, segment.Array.Take(segment.Count).ToArray()); _clientSendBuffer.WriteInt(ref pos, 0); - +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), channelId); +#else clientToServerTransport.ClientSend(channelId, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } } @@ -168,7 +183,11 @@ public override bool ServerDisconnect(int connectionId) } #endif +#if MIRROR_40_0_OR_NEWER + public override void ServerSend(int connectionId, ArraySegment segment, int channelId) +#else public override void ServerSend(int connectionId, int channelId, ArraySegment segment) +#endif { if (_directConnectModule != null && _connectedDirectClients.TryGetBySecond(connectionId, out int directId)) { @@ -180,8 +199,11 @@ public override void ServerSend(int connectionId, int channelId, ArraySegment(_clientSendBuffer, 0, pos), channelId); +#else clientToServerTransport.ClientSend(channelId, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } } @@ -240,8 +262,11 @@ public override void ServerStart() _clientSendBuffer.WriteBool(ref pos, false); _clientSendBuffer.WriteInt(ref pos, _directConnectModule == null ? 1 : _directConnectModule.SupportsNATPunch() ? _directConnectModule.GetTransportPort() : 1); } - +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } public override void ServerStop() @@ -252,7 +277,11 @@ public override void ServerStop() int pos = 0; _clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.LeaveRoom); +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif if (_directConnectModule != null) _directConnectModule.StopServer(); diff --git a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportRequests.cs b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportRequests.cs index ebdac9f7..d605f1d3 100644 --- a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportRequests.cs +++ b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LRMTransportRequests.cs @@ -116,7 +116,11 @@ IEnumerator JoinOtherRelayAndMatch(Room? roomValue, string ID) _isClient = true; +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new System.ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new System.ArraySegment(_clientSendBuffer, 0, pos)); +#endif } IEnumerator GetServerList(LRMRegions region) diff --git a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LightReflectiveMirrorTransport.cs b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LightReflectiveMirrorTransport.cs index 813e6166..1eaecdc3 100644 --- a/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LightReflectiveMirrorTransport.cs +++ b/UnityProject/Assets/Mirror/Runtime/Transport/LRM/LRMTransport/LightReflectiveMirrorTransport.cs @@ -128,7 +128,12 @@ void SendHeartbeat() // Send a blank message with just the opcode 200, which is heartbeat int pos = 0; _clientSendBuffer.WriteByte(ref pos, 200); + +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif // If NAT Puncher is initialized, send heartbeat on that as well. @@ -339,7 +344,11 @@ public void UpdateRoomName(string newServerName = "My Awesome Server!") _clientSendBuffer.WriteBool(ref pos, false); _clientSendBuffer.WriteBool(ref pos, false); +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } } @@ -355,8 +364,11 @@ public void UpdateRoomData(string newServerData = "Extra Data!") _clientSendBuffer.WriteString(ref pos, newServerData); _clientSendBuffer.WriteBool(ref pos, false); _clientSendBuffer.WriteBool(ref pos, false); - +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } } @@ -373,7 +385,11 @@ public void UpdateRoomVisibility(bool isPublic = true) _clientSendBuffer.WriteBool(ref pos, isPublic); _clientSendBuffer.WriteBool(ref pos, false); +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } } @@ -390,7 +406,11 @@ public void UpdateRoomPlayerCount(int maxPlayers = 16) _clientSendBuffer.WriteBool(ref pos, true); _clientSendBuffer.WriteInt(ref pos, maxPlayers); +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } } @@ -410,7 +430,12 @@ void SendAuthKey() int pos = 0; _clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.AuthenticationResponse); _clientSendBuffer.WriteString(ref pos, authenticationKey); + +#if MIRROR_40_0_OR_NEWER + clientToServerTransport.ClientSend(new ArraySegment(_clientSendBuffer, 0, pos), 0); +#else clientToServerTransport.ClientSend(0, new ArraySegment(_clientSendBuffer, 0, pos)); +#endif } public enum OpCodes