示例#1
0
 private IEnumerator WaitForServerResponse()
 {
     while (!handShakeSuccessful.HasValue)
     {
         countDown -= Time.deltaTime;
         if (countDown < 0)
         {
             break;
         }
         yield return(null);
     }
     countDown = TIMEOUT_DURATION; //reset coutdown;
     if (handShakeSuccessful.HasValue)
     {
         if ((bool)handShakeSuccessful)
         {
             Debug.Log("Load World");
             SceneManager.LoadScene("test", LoadSceneMode.Single);
             //load world instantly
         }
         else
         {
             Debug.Log("Received response but couldn't authenticate you with login server");
             //make status box with message saying something messed up
         }
     }
     else
     {
         genericBoxHandler.DestroyMessageOnlyStatusBox();
         statusBoxHandler.InstantiatePrefab(MenuPrefabs.StatusBox, "Connection to server timed out");
     }
 }
示例#2
0
 private IEnumerator WaitForServerResponse()
 {
     while (!handShakeSuccessful.HasValue)
     {
         handshakeTimeoutWait -= Time.deltaTime;
         if (handshakeTimeoutWait < 0)
         {
             break;
         }
         yield return(null);
     }
     if (handShakeSuccessful.HasValue)
     {
         if ((bool)handShakeSuccessful)
         {
             Data.CHARACTER_ON_LOGIN = characterEntering;
             loginServerConnection.SendDisconnectPacket();
             SceneManager.LoadScene("test", LoadSceneMode.Single);
             //load world instantly
         }
         else
         {
             Debug.Log("Received response but couldn't authenticate you with login server");
             //make status box with message saying something messed up
         }
     }
     else
     {
         genericBoxHandler.DestroyMessageOnlyStatusBox();
         statusBoxHandler.InstantiatePrefab(MenuPrefabs.StatusBox, "Connection to server timed out");
     }
 }