NetworkClient.HandleClientDisconnect: remove unnecessary connection parameter. it wasn't even used.

This commit is contained in:
vis2k 2021-03-13 13:44:34 +08:00
parent 4a47b1c7d2
commit d7ee25e589
3 changed files with 7 additions and 5 deletions

View File

@ -109,7 +109,7 @@ internal void DisconnectInternal()
// set not ready and handle clientscene disconnect in any case // set not ready and handle clientscene disconnect in any case
// (might be client or host mode here) // (might be client or host mode here)
isReady = false; isReady = false;
NetworkClient.HandleClientDisconnect(this); NetworkClient.HandleClientDisconnect();
} }
/// <summary>Disconnects this connection.</summary> /// <summary>Disconnects this connection.</summary>

View File

@ -203,7 +203,7 @@ public static void ConnectLocalServer()
public static void Disconnect() public static void Disconnect()
{ {
connectState = ConnectState.Disconnected; connectState = ConnectState.Disconnected;
HandleClientDisconnect(connection); HandleClientDisconnect();
// local or remote connection? // local or remote connection?
if (isLocalClient) if (isLocalClient)
@ -277,7 +277,7 @@ static void OnDisconnected()
{ {
connectState = ConnectState.Disconnected; connectState = ConnectState.Disconnected;
HandleClientDisconnect(connection); HandleClientDisconnect();
if (connection != null) OnDisconnectedEvent?.Invoke(connection); if (connection != null) OnDisconnectedEvent?.Invoke(connection);
} }
@ -792,7 +792,9 @@ public static bool Ready()
[Obsolete("NetworkClient.Ready doesn't need a NetworkConnection parameter anymore. It always uses NetworkClient.connection anyway.")] [Obsolete("NetworkClient.Ready doesn't need a NetworkConnection parameter anymore. It always uses NetworkClient.connection anyway.")]
public static bool Ready(NetworkConnection conn) => Ready(); public static bool Ready(NetworkConnection conn) => Ready();
internal static void HandleClientDisconnect(NetworkConnection conn) // TODO just set ready=false directly. the name doesn't imply what this
// function does.
internal static void HandleClientDisconnect()
{ {
ready = false; ready = false;
} }

View File

@ -23,7 +23,7 @@ public override void Disconnect()
// set not ready and handle clientscene disconnect in any case // set not ready and handle clientscene disconnect in any case
// (might be client or host mode here) // (might be client or host mode here)
isReady = false; isReady = false;
NetworkClient.HandleClientDisconnect(this); NetworkClient.HandleClientDisconnect();
Transport.activeTransport.ClientDisconnect(); Transport.activeTransport.ClientDisconnect();
} }
} }