mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
ClientScene: internal Shutdown moved to NetworkClient
This commit is contained in:
parent
ab1218fe17
commit
03f6ae59d3
@ -18,7 +18,7 @@ namespace Mirror
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ClientScene
|
public static class ClientScene
|
||||||
{
|
{
|
||||||
static bool isSpawnFinished;
|
internal static bool isSpawnFinished;
|
||||||
|
|
||||||
/// <summary> NetworkIdentity of the localPlayer </summary>
|
/// <summary> NetworkIdentity of the localPlayer </summary>
|
||||||
public static NetworkIdentity localPlayer { get; private set; }
|
public static NetworkIdentity localPlayer { get; private set; }
|
||||||
@ -30,7 +30,7 @@ public static class ClientScene
|
|||||||
// This connection can be used to send messages to the server. There can
|
// This connection can be used to send messages to the server. There can
|
||||||
// only be one ClientScene and ready connection at a time.
|
// only be one ClientScene and ready connection at a time.
|
||||||
// TODO ready ? NetworkClient.connection : null??????
|
// TODO ready ? NetworkClient.connection : null??????
|
||||||
public static NetworkConnection readyConnection { get; private set; }
|
public static NetworkConnection readyConnection { get; internal set; }
|
||||||
|
|
||||||
[Obsolete("ClientScene.prefabs was moved to NetworkClient.prefabs")]
|
[Obsolete("ClientScene.prefabs was moved to NetworkClient.prefabs")]
|
||||||
public static Dictionary<Guid, GameObject> prefabs => NetworkClient.prefabs;
|
public static Dictionary<Guid, GameObject> prefabs => NetworkClient.prefabs;
|
||||||
@ -435,16 +435,5 @@ public static void DestroyAllClientObjects()
|
|||||||
Debug.LogError("Could not DestroyAllClientObjects because spawned list was modified during loop, make sure you are not modifying NetworkIdentity.spawned by calling NetworkServer.Destroy or NetworkServer.Spawn in OnDestroy or OnDisable.");
|
Debug.LogError("Could not DestroyAllClientObjects because spawned list was modified during loop, make sure you are not modifying NetworkIdentity.spawned by calling NetworkServer.Destroy or NetworkServer.Spawn in OnDestroy or OnDisable.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// shutdown ////////////////////////////////////////////////////////////
|
|
||||||
internal static void Shutdown()
|
|
||||||
{
|
|
||||||
ClearSpawners();
|
|
||||||
spawnableObjects.Clear();
|
|
||||||
readyConnection = null;
|
|
||||||
ready = false;
|
|
||||||
isSpawnFinished = false;
|
|
||||||
DestroyAllClientObjects();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -882,14 +882,20 @@ internal static void NetworkLateUpdate()
|
|||||||
public static void Shutdown()
|
public static void Shutdown()
|
||||||
{
|
{
|
||||||
Debug.Log("Shutting down client.");
|
Debug.Log("Shutting down client.");
|
||||||
ClientScene.Shutdown();
|
ClearSpawners();
|
||||||
|
ClientScene.spawnableObjects.Clear();
|
||||||
|
ClientScene.readyConnection = null;
|
||||||
|
ClientScene.ready = false;
|
||||||
|
ClientScene.isSpawnFinished = false;
|
||||||
|
ClientScene.DestroyAllClientObjects();
|
||||||
connectState = ConnectState.None;
|
connectState = ConnectState.None;
|
||||||
handlers.Clear();
|
handlers.Clear();
|
||||||
// disconnect the client connection.
|
// disconnect the client connection.
|
||||||
// we do NOT call Transport.Shutdown, because someone only called
|
// we do NOT call Transport.Shutdown, because someone only called
|
||||||
// NetworkClient.Shutdown. we can't assume that the server is
|
// NetworkClient.Shutdown. we can't assume that the server is
|
||||||
// supposed to be shut down too!
|
// supposed to be shut down too!
|
||||||
Transport.activeTransport.ClientDisconnect();
|
if (Transport.activeTransport != null)
|
||||||
|
Transport.activeTransport.ClientDisconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public void OneTimeSetUp()
|
|||||||
[TearDown]
|
[TearDown]
|
||||||
public virtual void TearDown()
|
public virtual void TearDown()
|
||||||
{
|
{
|
||||||
ClientScene.Shutdown();
|
NetworkClient.Shutdown();
|
||||||
// reset asset id in case they are changed by tests
|
// reset asset id in case they are changed by tests
|
||||||
validPrefabNetworkIdentity.assetId = validPrefabGuid;
|
validPrefabNetworkIdentity.assetId = validPrefabGuid;
|
||||||
|
|
||||||
|
@ -376,7 +376,6 @@ public void SendCommandInternal()
|
|||||||
// clean up
|
// clean up
|
||||||
RemoteCallHelper.RemoveDelegate(registeredHash);
|
RemoteCallHelper.RemoveDelegate(registeredHash);
|
||||||
// clear clientscene.readyconnection
|
// clear clientscene.readyconnection
|
||||||
ClientScene.Shutdown();
|
|
||||||
NetworkClient.Shutdown();
|
NetworkClient.Shutdown();
|
||||||
NetworkServer.Shutdown();
|
NetworkServer.Shutdown();
|
||||||
Transport.activeTransport = null;
|
Transport.activeTransport = null;
|
||||||
@ -458,7 +457,6 @@ public void SendRPCInternal()
|
|||||||
// clean up
|
// clean up
|
||||||
RemoteCallHelper.RemoveDelegate(registeredHash);
|
RemoteCallHelper.RemoveDelegate(registeredHash);
|
||||||
// clear clientscene.readyconnection
|
// clear clientscene.readyconnection
|
||||||
ClientScene.Shutdown();
|
|
||||||
NetworkServer.RemoveLocalConnection();
|
NetworkServer.RemoveLocalConnection();
|
||||||
NetworkClient.Shutdown();
|
NetworkClient.Shutdown();
|
||||||
NetworkServer.Shutdown();
|
NetworkServer.Shutdown();
|
||||||
@ -547,7 +545,6 @@ public void SendTargetRPCInternal()
|
|||||||
// clean up
|
// clean up
|
||||||
RemoteCallHelper.RemoveDelegate(registeredHash);
|
RemoteCallHelper.RemoveDelegate(registeredHash);
|
||||||
// clear clientscene.readyconnection
|
// clear clientscene.readyconnection
|
||||||
ClientScene.Shutdown();
|
|
||||||
NetworkServer.RemoveLocalConnection();
|
NetworkServer.RemoveLocalConnection();
|
||||||
NetworkClient.Shutdown();
|
NetworkClient.Shutdown();
|
||||||
NetworkServer.Shutdown();
|
NetworkServer.Shutdown();
|
||||||
|
@ -353,7 +353,6 @@ public void HostMode_IsFlags_Test()
|
|||||||
// stop the client
|
// stop the client
|
||||||
NetworkClient.Shutdown();
|
NetworkClient.Shutdown();
|
||||||
NetworkServer.RemoveLocalConnection();
|
NetworkServer.RemoveLocalConnection();
|
||||||
ClientScene.Shutdown();
|
|
||||||
|
|
||||||
// stop the server
|
// stop the server
|
||||||
NetworkServer.Shutdown();
|
NetworkServer.Shutdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user