This commit is contained in:
vis2k 2021-03-07 13:30:14 +08:00
parent 85287fe642
commit b2490f9c1f

View File

@ -649,13 +649,7 @@ public static void RegisterHandler<T>(Action<NetworkConnection, T> handler, bool
handlers[msgType] = MessagePacking.WrapHandler(handler, requireAuthentication); handlers[msgType] = MessagePacking.WrapHandler(handler, requireAuthentication);
} }
/// <summary> /// <summary>Register a handler for message type T. Most should require authentication.</summary>
/// Register a handler for a particular message type.
/// <para>There are several system message types which you can add handlers for. You can also add your own message types.</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>
[Obsolete("Use RegisterHandler(Action<NetworkConnection, T), requireAuthentication instead.")] [Obsolete("Use RegisterHandler(Action<NetworkConnection, T), requireAuthentication instead.")]
public static void RegisterHandler<T>(Action<T> handler, bool requireAuthentication = true) public static void RegisterHandler<T>(Action<T> handler, bool requireAuthentication = true)
where T : struct, NetworkMessage where T : struct, NetworkMessage
@ -663,13 +657,7 @@ public static void RegisterHandler<T>(Action<T> handler, bool requireAuthenticat
RegisterHandler<T>((_, value) => { handler(value); }, requireAuthentication); RegisterHandler<T>((_, value) => { handler(value); }, requireAuthentication);
} }
/// <summary> /// <summary>Replace a handler for message type T. Most should require authentication.</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) public static void ReplaceHandler<T>(Action<NetworkConnection, T> handler, bool requireAuthentication = true)
where T : struct, NetworkMessage where T : struct, NetworkMessage
{ {