mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
use local function
This commit is contained in:
parent
a66fefb1e3
commit
b7a6932b93
@ -329,8 +329,8 @@ public static void RegisterHandler<T>(Action<T> handler, bool requireAuthenticat
|
||||
// we use the same WrapHandler function for server and client.
|
||||
// so let's wrap it to ignore the NetworkConnection parameter.
|
||||
// it's not needed on client. it's always NetworkClient.connection.
|
||||
Action<NetworkConnection, T> handlerWrapped = (_, value) => { handler(value); };
|
||||
handlers[msgType] = MessagePacking.WrapHandler(handlerWrapped, requireAuthentication);
|
||||
void HandlerWrapped(NetworkConnection _, T value) => handler(value);
|
||||
handlers[msgType] = MessagePacking.WrapHandler((Action<NetworkConnection, T>) HandlerWrapped, requireAuthentication);
|
||||
}
|
||||
|
||||
/// <summary>Replace a handler for a particular message type. Should require authentication by default.</summary>
|
||||
|
Loading…
Reference in New Issue
Block a user