public void UseExternalClient(QNetworkClient externalClient) { if (runInBackground) { Application.runInBackground = true; } if (externalClient != null) { client = externalClient; isNetworkActive = true; RegisterClientMessages(client); OnStartClient(client); } else { OnStopClient(); QClientScene.DestroyAllClientObjects(); QClientScene.HandleClientDisconnect(client.connection); client = null; if (!string.IsNullOrEmpty(offlineScene)) { ClientChangeScene(offlineScene, false); } } s_Address = networkAddress; }
public void StopClient() { OnStopClient(); QLog.Log("NetworkManager StopClient"); isNetworkActive = false; if (client != null) { client.Disconnect(); client.Shutdown(); client = null; } QClientScene.DestroyAllClientObjects(); if (!string.IsNullOrEmpty(offlineScene)) { ClientChangeScene(offlineScene, false); } CleanupNetworkIdentities(); }