示例#1
0
 private IEnumerator StartClient()
 {
     Client.Instance.ConnectToServer();
     Debug.Log("Connecting to server");
     for (int counter = 0; counter < 10; counter++)
     {
         // Progress text: Connecting
         _progressText.text = "Connecting";
         if (Client.Instance.tcp.SocketConnected())
         {
             if (DataManager.Instance._dataExists)
             {
                 // Progress text: Getting data
                 _progressText.text = "Getting data";
                 ClientSend.AccountDataRequest(Account.Current.ID, Account.Current.Username);
             }
             else
             {
                 _progressText.text = "Connected";
                 _startScreen.StartScene();
             }
             yield break;
         }
         yield return(new WaitForSeconds(1f));
     }
     _connectionError.SetActive(true);
 }