This commit is contained in:
vis2k 2021-03-13 19:49:45 +08:00
parent b9027737c8
commit df2330239f

View File

@ -10,6 +10,7 @@ public abstract class NetworkConnection
public const int LocalConnectionId = 0; public const int LocalConnectionId = 0;
// NetworkIdentities that this connection can see // NetworkIdentities that this connection can see
// TODO move to server's NetworkConnectionToClient?
internal readonly HashSet<NetworkIdentity> observing = new HashSet<NetworkIdentity>(); internal readonly HashSet<NetworkIdentity> observing = new HashSet<NetworkIdentity>();
// TODO this is NetworkServer.handlers on server and NetworkClient.handlers on client. // TODO this is NetworkServer.handlers on server and NetworkClient.handlers on client.
@ -113,6 +114,7 @@ protected static bool ValidatePacketSize(ArraySegment<byte> segment, int channel
public override string ToString() => $"connection({connectionId})"; public override string ToString() => $"connection({connectionId})";
// TODO move to server's NetworkConnectionToClient?
internal void AddToObserving(NetworkIdentity netIdentity) internal void AddToObserving(NetworkIdentity netIdentity)
{ {
observing.Add(netIdentity); observing.Add(netIdentity);
@ -121,6 +123,7 @@ internal void AddToObserving(NetworkIdentity netIdentity)
NetworkServer.ShowForConnection(netIdentity, this); NetworkServer.ShowForConnection(netIdentity, this);
} }
// TODO move to server's NetworkConnectionToClient?
internal void RemoveFromObserving(NetworkIdentity netIdentity, bool isDestroyed) internal void RemoveFromObserving(NetworkIdentity netIdentity, bool isDestroyed)
{ {
observing.Remove(netIdentity); observing.Remove(netIdentity);
@ -132,6 +135,7 @@ internal void RemoveFromObserving(NetworkIdentity netIdentity, bool isDestroyed)
} }
} }
// TODO move to server's NetworkConnectionToClient?
internal void RemoveObservers() internal void RemoveObservers()
{ {
foreach (NetworkIdentity netIdentity in observing) foreach (NetworkIdentity netIdentity in observing)