This commit is contained in:
vis2k 2021-03-07 14:39:50 +08:00
parent 8f5c6c7b93
commit ebcaf9a256

View File

@ -681,10 +681,7 @@ public static void UnregisterHandler<T>()
}
/// <summary>Clears all registered message handlers.</summary>
public static void ClearHandlers()
{
handlers.Clear();
}
public static void ClearHandlers() => handlers.Clear();
/// <summary>Send this message to the player only</summary>
[Obsolete("Use identity.connectionToClient.Send() instead! Previously Mirror needed this function internally, but not anymore.")]
@ -721,14 +718,13 @@ public static bool ReplacePlayerForConnection(NetworkConnection conn, GameObject
return InternalReplacePlayerForConnection(conn, player, keepAuthority);
}
/// <summary>
/// <para>When an AddPlayer message handler has received a request from a player, the server calls this to associate the player object with the connection.</para>
/// <para>When a player is added for a connection, the client for that connection is made ready automatically. The player object is automatically spawned, so you do not need to call NetworkServer.Spawn for that object. This function is used for "adding" a player, not for "replacing" the player on a connection. If there is already a player on this playerControllerId for this connection, this will fail.</para>
/// </summary>
/// <param name="conn">Connection which is adding the player.</param>
/// <param name="player">Player object spawned for the player.</param>
/// <param name="assetId"></param>
/// <returns>True if connection was successfully added for a connection.</returns>
/// <summary>Called by server after AddPlayer message to add the player for the connection.</summary>
// When a player is added for a connection, the client for that
// connection is made ready automatically. The player object is
// automatically spawned, so you do not need to call NetworkServer.Spawn
// for that object. This function is used for "adding" a player, not for
// "replacing" the player on a connection. If there is already a player
// on this playerControllerId for this connection, this will fail.
public static bool AddPlayerForConnection(NetworkConnection conn, GameObject player, Guid assetId)
{
if (GetNetworkIdentity(player, out NetworkIdentity identity))