Remove NetworkClient.ReplaceHandler

This commit is contained in:
vis2k 2020-09-30 10:21:10 +02:00
parent 84cf753f19
commit de6b63ef2f

View File

@ -220,33 +220,6 @@ public static void RegisterHandler<T>(Action<T> handler, bool requireAuthenticat
RegisterHandler((NetworkConnection _, T value) => { handler(value); }, requireAuthentication);
}
/// <summary>
/// Replaces a handler for a particular message type.
/// <para>See also <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)">RegisterHandler(T)(Action(NetworkConnection, T), bool)</see></para>
/// </summary>
/// <typeparam name="T">Message type</typeparam>
/// <param name="handler">Function handler which will be invoked when this message type is received.</param>
/// <param name="requireAuthentication">True if the message requires an authenticated connection</param>
public static void ReplaceHandler<T>(Action<NetworkConnection, T> handler, bool requireAuthentication = true)
where T : struct, NetworkMessage
{
int msgType = MessagePacker.GetId<T>();
handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication);
}
/// <summary>
/// Replaces a handler for a particular message type.
/// <para>See also <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)">RegisterHandler(T)(Action(NetworkConnection, T), bool)</see></para>
/// </summary>
/// <typeparam name="T">Message type</typeparam>
/// <param name="handler">Function handler which will be invoked when this message type is received.</param>
/// <param name="requireAuthentication">True if the message requires an authenticated connection</param>
public static void ReplaceHandler<T>(Action<T> handler, bool requireAuthentication = true)
where T : struct, NetworkMessage
{
ReplaceHandler((NetworkConnection _, T value) => { handler(value); }, requireAuthentication);
}
/// <summary>
/// Unregisters a network message handler.
/// </summary>