Skip to content

Commit e45920e

Browse files
authored
fix: add missing properties to interface (MirageNet#617)
* fix: add missing properties to interface * add summaries
1 parent e823c34 commit e45920e

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

Assets/Mirage/Runtime/INetworkClient.cs

+21
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@ public interface INetworkClient
2121
/// </summary>
2222
UnityEvent Disconnected { get; }
2323

24+
/// <summary>
25+
/// The NetworkConnection object this client is using.
26+
/// </summary>
27+
INetworkConnection Connection { get; }
28+
29+
/// <summary>
30+
/// NetworkIdentity of the localPlayer
31+
/// </summary>
32+
NetworkIdentity LocalPlayer { get; }
33+
34+
/// <summary>
35+
/// active is true while a client is connecting/connected
36+
/// (= while the network is active)
37+
/// </summary>
38+
bool Active { get; }
39+
40+
/// <summary>
41+
/// NetworkClient can connect to local server in host mode too
42+
/// </summary>
43+
bool IsLocalClient { get; }
44+
2445
void Disconnect();
2546

2647
void Send<T>(T message, int channelId = Channel.Reliable);

Assets/Mirage/Runtime/INetworkServer.cs

+21
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,27 @@ public interface INetworkServer
3737
/// </summary>
3838
UnityEvent OnStopHost { get; }
3939

40+
/// <summary>
41+
/// The connection to the host mode client (if any).
42+
/// </summary>
43+
INetworkConnection LocalConnection { get; }
44+
45+
/// <summary>
46+
/// The host client for this server
47+
/// </summary>
48+
NetworkClient LocalClient { get; }
49+
50+
/// <summary>
51+
/// True if there is a local client connected to this server (host mode)
52+
/// </summary>
53+
bool LocalClientActive { get; }
54+
55+
/// <summary>
56+
/// <para>Checks if the server has been started.</para>
57+
/// <para>This will be true after NetworkServer.Listen() has been called.</para>
58+
/// </summary>
59+
bool Active { get; }
60+
4061
void Disconnect();
4162

4263
void AddConnection(INetworkConnection conn);

Assets/Mirage/Runtime/NetworkServer.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ public class NetworkServer : MonoBehaviour, INetworkServer
9595
// => removed it for easier code. use .localConnection now!
9696
public INetworkConnection LocalConnection { get; private set; }
9797

98-
// The host client for this server
98+
/// <summary>
99+
/// The host client for this server
100+
/// </summary>
99101
public NetworkClient LocalClient { get; private set; }
100102

101103
/// <summary>

0 commit comments

Comments
 (0)