mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
breaking: NetworkConnectionToServer.clientOwnedObjects renamed to .owned (simplify API)
This commit is contained in:
parent
8cb64383fc
commit
6bb42e9e81
@ -271,7 +271,7 @@ public override void OnServerDisconnect(NetworkConnectionToClient conn)
|
||||
if (roomPlayer != null)
|
||||
roomSlots.Remove(roomPlayer);
|
||||
|
||||
foreach (NetworkIdentity clientOwnedObject in conn.clientOwnedObjects)
|
||||
foreach (NetworkIdentity clientOwnedObject in conn.owned)
|
||||
{
|
||||
roomPlayer = clientOwnedObject.GetComponent<NetworkRoomPlayer>();
|
||||
if (roomPlayer != null)
|
||||
|
@ -47,8 +47,8 @@ public abstract class NetworkConnection
|
||||
// netId anymore: https://github.com/vis2k/Mirror/issues/1380
|
||||
// Works fine with NetworkIdentity pointers though.
|
||||
// DEPRECATED 2022-02-05
|
||||
[Obsolete("Cast to NetworkConnectionToClient to access .clientOwnedObjects")]
|
||||
public HashSet<NetworkIdentity> clientOwnedObjects => ((NetworkConnectionToClient)this).clientOwnedObjects;
|
||||
[Obsolete("Cast to NetworkConnectionToClient to access .owned")]
|
||||
public HashSet<NetworkIdentity> clientOwnedObjects => ((NetworkConnectionToClient)this).owned;
|
||||
|
||||
// batching from server to client & client to server.
|
||||
// fewer transport calls give us significantly better performance/scale.
|
||||
|
@ -18,7 +18,10 @@ public class NetworkConnectionToClient : NetworkConnection
|
||||
// fixes a bug where DestroyOwnedObjects wouldn't find the
|
||||
// netId anymore: https://github.com/vis2k/Mirror/issues/1380
|
||||
// Works fine with NetworkIdentity pointers though.
|
||||
public new readonly HashSet<NetworkIdentity> clientOwnedObjects = new HashSet<NetworkIdentity>();
|
||||
public readonly HashSet<NetworkIdentity> owned = new HashSet<NetworkIdentity>();
|
||||
|
||||
[Obsolete(".clientOwnedObjects was renamed to .owned :)")] // 2022-10-13
|
||||
public new HashSet<NetworkIdentity> clientOwnedObjects => owned;
|
||||
|
||||
// unbatcher
|
||||
public Unbatcher unbatcher = new Unbatcher();
|
||||
@ -76,18 +79,18 @@ internal void RemoveFromObservingsObservers()
|
||||
|
||||
internal void AddOwnedObject(NetworkIdentity obj)
|
||||
{
|
||||
clientOwnedObjects.Add(obj);
|
||||
owned.Add(obj);
|
||||
}
|
||||
|
||||
internal void RemoveOwnedObject(NetworkIdentity obj)
|
||||
{
|
||||
clientOwnedObjects.Remove(obj);
|
||||
owned.Remove(obj);
|
||||
}
|
||||
|
||||
internal void DestroyOwnedObjects()
|
||||
{
|
||||
// create a copy because the list might be modified when destroying
|
||||
HashSet<NetworkIdentity> tmp = new HashSet<NetworkIdentity>(clientOwnedObjects);
|
||||
HashSet<NetworkIdentity> tmp = new HashSet<NetworkIdentity>(owned);
|
||||
foreach (NetworkIdentity netIdentity in tmp)
|
||||
{
|
||||
if (netIdentity != null)
|
||||
@ -97,7 +100,7 @@ internal void DestroyOwnedObjects()
|
||||
}
|
||||
|
||||
// clear the hashset because we destroyed them all
|
||||
clientOwnedObjects.Clear();
|
||||
owned.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user