コード例 #1
0
 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;
 }
コード例 #2
0
 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();
 }