public IEnumerator RequestGameSession()

in UnityProject/Assets/Scripts/Client/NetworkClient.cs [30:68]


	public IEnumerator RequestGameSession()
	{
		Debug.Log("Request matchmaking...");
		GameObject.FindObjectOfType<UIManager>().SetTextBox("Requesting game session...");
		yield return null;

		bool gameSessionFound = false;
		int tries = 0;
        while (!gameSessionFound)
        {
			GameObject.FindObjectOfType<UIManager>().SetTextBox("Requesting game session...");
			yield return null;
			this.gameSessionInfo = this.matchmakingClient.RequestGameSession();
			if (gameSessionInfo == null)
			{
				GameObject.FindObjectOfType<UIManager>().SetTextBox("No game session found yet, trying again...");
				yield return new WaitForSeconds(1.0f);
			}
			else
			{
				Debug.Log("Got session: " + gameSessionInfo.publicIP + " " + gameSessionInfo.port);
				GameObject.FindObjectOfType<UIManager>().SetTextBox("Found a game server, connecting...");
				yield return null;

				gameSessionFound = true;
				// game session found, connect to the server
				Connect();
			}
			tries++;

			if(tries > 20)
            {
				GameObject.FindObjectOfType<UIManager>().SetTextBox("Aborting game session search, no game found in 20 seconds");
				Debug.Log("Aborting game session search, no game found in 20 seconds");
				yield return null;
				break;
			}
		}
	}