mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkClient.activeHost to replace .isHostClient (consistent with NetworkServer.activeHost)
This commit is contained in:
parent
a4f3872a01
commit
0e9edbd0ad
@ -63,11 +63,15 @@ public static partial class NetworkClient
|
|||||||
// empty if the client has not connected yet.
|
// empty if the client has not connected yet.
|
||||||
public static string serverIp => connection.address;
|
public static string serverIp => connection.address;
|
||||||
|
|
||||||
/// <summary>active is true while a client is connecting/connected</summary>
|
/// <summary>active is true while a client is connecting/connected either as standalone or as host client.</summary>
|
||||||
// (= while the network is active)
|
// (= while the network is active)
|
||||||
public static bool active => connectState == ConnectState.Connecting ||
|
public static bool active => connectState == ConnectState.Connecting ||
|
||||||
connectState == ConnectState.Connected;
|
connectState == ConnectState.Connected;
|
||||||
|
|
||||||
|
/// <summary>active is true while the client is connected in host mode.</summary>
|
||||||
|
// naming consistent with NetworkServer.activeHost.
|
||||||
|
public static bool activeHost => connection is LocalConnectionToServer;
|
||||||
|
|
||||||
/// <summary>Check if client is connecting (before connected).</summary>
|
/// <summary>Check if client is connecting (before connected).</summary>
|
||||||
public static bool isConnecting => connectState == ConnectState.Connecting;
|
public static bool isConnecting => connectState == ConnectState.Connecting;
|
||||||
|
|
||||||
@ -75,7 +79,8 @@ public static partial class NetworkClient
|
|||||||
public static bool isConnected => connectState == ConnectState.Connected;
|
public static bool isConnected => connectState == ConnectState.Connected;
|
||||||
|
|
||||||
/// <summary>True if client is running in host mode.</summary>
|
/// <summary>True if client is running in host mode.</summary>
|
||||||
public static bool isHostClient => connection is LocalConnectionToServer;
|
[Obsolete("NetworkClient.isHostClient was renamed to .activeHost to be more obvious")] // DEPRECATED 2022-12-12
|
||||||
|
public static bool isHostClient => activeHost;
|
||||||
|
|
||||||
// OnConnected / OnDisconnected used to be NetworkMessages that were
|
// OnConnected / OnDisconnected used to be NetworkMessages that were
|
||||||
// invoked. this introduced a bug where external clients could send
|
// invoked. this introduced a bug where external clients could send
|
||||||
|
@ -60,6 +60,7 @@ public static partial class NetworkServer
|
|||||||
public static bool active { get; internal set; }
|
public static bool active { get; internal set; }
|
||||||
|
|
||||||
/// <summary>active checks if the server has been started in host mode.</summary>
|
/// <summary>active checks if the server has been started in host mode.</summary>
|
||||||
|
// naming consistent with NetworkClient.activeHost.
|
||||||
public static bool activeHost => localConnection != null;
|
public static bool activeHost => localConnection != null;
|
||||||
|
|
||||||
// scene loading
|
// scene loading
|
||||||
|
Loading…
Reference in New Issue
Block a user