mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
syntax
This commit is contained in:
parent
78d511f65f
commit
4a1be60ad7
@ -329,7 +329,7 @@ internal static void OnTransportData(ArraySegment<byte> data, int channelId)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.LogWarning($"NetworkClient: failed to add batch.");
|
Debug.LogWarning($"NetworkClient: failed to add batch.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,10 +573,10 @@ public static void ReplaceHandler<T>(Action<NetworkConnection, T> handler, bool
|
|||||||
// so let's wrap it to ignore the NetworkConnection parameter.
|
// so let's wrap it to ignore the NetworkConnection parameter.
|
||||||
// it's not needed on client. it's always NetworkClient.connection.
|
// it's not needed on client. it's always NetworkClient.connection.
|
||||||
ushort msgType = NetworkMessageId<T>.Id;
|
ushort msgType = NetworkMessageId<T>.Id;
|
||||||
|
|
||||||
// register Id <> Type in lookup for debugging.
|
// register Id <> Type in lookup for debugging.
|
||||||
NetworkMessages.Lookup[msgType] = typeof(T);
|
NetworkMessages.Lookup[msgType] = typeof(T);
|
||||||
|
|
||||||
void HandlerWrapped(NetworkConnection _, T value) => handler(_, value);
|
void HandlerWrapped(NetworkConnection _, T value) => handler(_, value);
|
||||||
handlers[msgType] = NetworkMessages.WrapHandler((Action<NetworkConnection, T>)HandlerWrapped, requireAuthentication, exceptionsDisconnect);
|
handlers[msgType] = NetworkMessages.WrapHandler((Action<NetworkConnection, T>)HandlerWrapped, requireAuthentication, exceptionsDisconnect);
|
||||||
}
|
}
|
||||||
@ -591,10 +591,10 @@ public static void ReplaceHandler<T>(Action<T> handler, bool requireAuthenticati
|
|||||||
// so let's wrap it to ignore the NetworkConnection parameter.
|
// so let's wrap it to ignore the NetworkConnection parameter.
|
||||||
// it's not needed on client. it's always NetworkClient.connection.
|
// it's not needed on client. it's always NetworkClient.connection.
|
||||||
ushort msgType = NetworkMessageId<T>.Id;
|
ushort msgType = NetworkMessageId<T>.Id;
|
||||||
|
|
||||||
// register Id <> Type in lookup for debugging.
|
// register Id <> Type in lookup for debugging.
|
||||||
NetworkMessages.Lookup[msgType] = typeof(T);
|
NetworkMessages.Lookup[msgType] = typeof(T);
|
||||||
|
|
||||||
void HandlerWrapped(NetworkConnection _, T value) => handler(value);
|
void HandlerWrapped(NetworkConnection _, T value) => handler(value);
|
||||||
handlers[msgType] = NetworkMessages.WrapHandler((Action<NetworkConnection, T>)HandlerWrapped, requireAuthentication, exceptionsDisconnect);
|
handlers[msgType] = NetworkMessages.WrapHandler((Action<NetworkConnection, T>)HandlerWrapped, requireAuthentication, exceptionsDisconnect);
|
||||||
}
|
}
|
||||||
@ -609,10 +609,10 @@ public static void ReplaceHandler<T>(Action<T, int> handler, bool requireAuthent
|
|||||||
// so let's wrap it to ignore the NetworkConnection parameter.
|
// so let's wrap it to ignore the NetworkConnection parameter.
|
||||||
// it's not needed on client. it's always NetworkClient.connection.
|
// it's not needed on client. it's always NetworkClient.connection.
|
||||||
ushort msgType = NetworkMessageId<T>.Id;
|
ushort msgType = NetworkMessageId<T>.Id;
|
||||||
|
|
||||||
// register Id <> Type in lookup for debugging.
|
// register Id <> Type in lookup for debugging.
|
||||||
NetworkMessages.Lookup[msgType] = typeof(T);
|
NetworkMessages.Lookup[msgType] = typeof(T);
|
||||||
|
|
||||||
void HandlerWrapped(NetworkConnection _, T value, int channelId) => handler(value, channelId);
|
void HandlerWrapped(NetworkConnection _, T value, int channelId) => handler(value, channelId);
|
||||||
handlers[msgType] = NetworkMessages.WrapHandler((Action<NetworkConnection, T, int>)HandlerWrapped, requireAuthentication, exceptionsDisconnect);
|
handlers[msgType] = NetworkMessages.WrapHandler((Action<NetworkConnection, T, int>)HandlerWrapped, requireAuthentication, exceptionsDisconnect);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user