mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
cleanup
This commit is contained in:
parent
b2490f9c1f
commit
a5bc753150
@ -665,23 +665,14 @@ public static void ReplaceHandler<T>(Action<NetworkConnection, T> handler, bool
|
|||||||
handlers[msgType] = MessagePacking.WrapHandler(handler, requireAuthentication);
|
handlers[msgType] = MessagePacking.WrapHandler(handler, 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<T> handler, bool requireAuthentication = true)
|
public static void ReplaceHandler<T>(Action<T> handler, bool requireAuthentication = true)
|
||||||
where T : struct, NetworkMessage
|
where T : struct, NetworkMessage
|
||||||
{
|
{
|
||||||
ReplaceHandler<T>((_, value) => { handler(value); }, requireAuthentication);
|
ReplaceHandler<T>((_, value) => { handler(value); }, requireAuthentication);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>Unregister a handler for a message type T.</summary>
|
||||||
/// Unregisters a handler for a particular message type.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Message type</typeparam>
|
|
||||||
public static void UnregisterHandler<T>()
|
public static void UnregisterHandler<T>()
|
||||||
where T : struct, NetworkMessage
|
where T : struct, NetworkMessage
|
||||||
{
|
{
|
||||||
@ -689,20 +680,13 @@ public static void UnregisterHandler<T>()
|
|||||||
handlers.Remove(msgType);
|
handlers.Remove(msgType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>Clears all registered message handlers.</summary>
|
||||||
/// Clear all registered callback handlers.
|
|
||||||
/// </summary>
|
|
||||||
public static void ClearHandlers()
|
public static void ClearHandlers()
|
||||||
{
|
{
|
||||||
handlers.Clear();
|
handlers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>Send this message to the player only</summary>
|
||||||
/// send this message to the player only
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Message type</typeparam>
|
|
||||||
/// <param name="identity"></param>
|
|
||||||
/// <param name="msg"></param>
|
|
||||||
[Obsolete("Use identity.connectionToClient.Send() instead! Previously Mirror needed this function internally, but not anymore.")]
|
[Obsolete("Use identity.connectionToClient.Send() instead! Previously Mirror needed this function internally, but not anymore.")]
|
||||||
public static void SendToClientOfPlayer<T>(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable)
|
public static void SendToClientOfPlayer<T>(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable)
|
||||||
where T : struct, NetworkMessage
|
where T : struct, NetworkMessage
|
||||||
|
Loading…
Reference in New Issue
Block a user