diff --git a/Assets/Mirage/Runtime/INetworkPlayer.cs b/Assets/Mirage/Runtime/INetworkPlayer.cs index f0a309081a..340a11f5dd 100644 --- a/Assets/Mirage/Runtime/INetworkPlayer.cs +++ b/Assets/Mirage/Runtime/INetworkPlayer.cs @@ -120,14 +120,28 @@ public interface IObjectOwner /// public interface INetworkPlayer : IMessageSender, IVisibilityTracker, IObjectOwner, ISceneLoader { - SocketLayer.IEndPoint Address { get; } - SocketLayer.IConnection Connection { get; } + IConnection Connection { get; } + + /// + /// The IP address / URL / FQDN associated with the connection. + /// Can be useful for a game master to do IP Bans etc. + /// + /// Best used to get concrete Endpoint type based on the being used + /// + /// + IEndPoint Address { get; } + + /// Connect called on client, but server has not replied yet + bool IsConnecting { get; } + + /// Server and Client are connected and can send messages + bool IsConnected { get; } + PlayerAuthentication Authentication { get; } void SetAuthentication(PlayerAuthentication authentication, bool allowReplace = false); bool IsAuthenticated { get; } - /// - /// True if this Player is the local player on the server or client - /// + + /// True if this Player is the local player on the server or client bool IsHost { get; } void Disconnect(); @@ -136,9 +150,7 @@ public interface INetworkPlayer : IMessageSender, IVisibilityTracker, IObjectOwn public interface ISceneLoader { - /// - /// Scene is fully loaded and we now can do things with player. - /// + /// Scene is fully loaded and we now can do things with player. bool SceneIsReady { get; set; } } } diff --git a/Assets/Mirage/Runtime/NetworkIdentity.cs b/Assets/Mirage/Runtime/NetworkIdentity.cs index 8f124fed97..d4f21cb992 100644 --- a/Assets/Mirage/Runtime/NetworkIdentity.cs +++ b/Assets/Mirage/Runtime/NetworkIdentity.cs @@ -950,7 +950,7 @@ internal void AddObserver(INetworkPlayer player) return; } - if (logger.LogEnabled()) logger.Log($"Adding '{player.Connection.EndPoint}' as an observer for {gameObject}"); + if (logger.LogEnabled()) logger.Log($"Adding '{player}' as an observer for {gameObject}"); observers.Add(player); player.AddToVisList(this); diff --git a/Assets/Mirage/Runtime/NetworkPlayer.cs b/Assets/Mirage/Runtime/NetworkPlayer.cs index b8053d0a41..620ea77306 100644 --- a/Assets/Mirage/Runtime/NetworkPlayer.cs +++ b/Assets/Mirage/Runtime/NetworkPlayer.cs @@ -82,13 +82,22 @@ public void SetAuthentication(PlayerAuthentication authentication, bool allowRep /// public bool HasCharacter => Identity != null; + public IConnection Connection => _connection; + /// /// The IP address / URL / FQDN associated with the connection. /// Can be useful for a game master to do IP Bans etc. + /// + /// Best used to get concrete Endpoint type based on the being used + /// /// public IEndPoint Address => _connection.EndPoint; - public IConnection Connection => _connection; + /// Connect called on client, but server has not replied yet + public bool IsConnecting => _connection.State == ConnectionState.Connecting; + + /// Server and Client are connected and can send messages + public bool IsConnected => _connection.State == ConnectionState.Connected; /// /// List of all networkIdentity that this player can see