Skip to content

Commit

Permalink
refactor: removing address property from player (MirageNet#691)
Browse files Browse the repository at this point in the history
* refactor: removing address property from player

address just passthrough to connection.
new concept: players can no longer has an address, but their connection does

BREAKING CHANGE: Address replaced with Connection.GetEndPointAddress

* updating uses of Address
  • Loading branch information
James-Frowen committed Mar 13, 2021
1 parent e1daf92 commit d772e53
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Assets/Mirage/Editor/NetworkInformationPreview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ float DrawObservers(NetworkIdentity identity, float initialX, float Y)
foreach (INetworkPlayer conn in identity.observers)
{

GUI.Label(observerRect, conn.Address + ":" + conn, styles.ComponentName);
GUI.Label(observerRect, conn.Connection.GetEndPointAddress() + ":" + conn, styles.ComponentName);
observerRect.y += observerRect.height;
Y = observerRect.y;
}
Expand Down
2 changes: 0 additions & 2 deletions Assets/Mirage/Runtime/INetworkPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net;
using Cysharp.Threading.Tasks;

namespace Mirage
Expand Down Expand Up @@ -101,7 +100,6 @@ public interface IObjectOwner
public interface INetworkPlayer : IMessageHandler, IVisibilityTracker, IObjectOwner
{
bool IsReady { get; set; }
EndPoint Address { get; }
object AuthenticationData { get; set; }

IConnection Connection { get; }
Expand Down
2 changes: 1 addition & 1 deletion Assets/Mirage/Runtime/NetworkIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ internal void AddObserver(INetworkPlayer conn)
return;
}

if (logger.LogEnabled()) logger.Log("Added observer " + conn.Address + " added for " + gameObject);
if (logger.LogEnabled()) logger.Log("Added observer " + conn.Connection.GetEndPointAddress() + " added for " + gameObject);
observers.Add(conn);
conn.AddToVisList(this);

Expand Down

0 comments on commit d772e53

Please sign in to comment.