Skip to content
Snippets Groups Projects
Commit 4c145a67 authored by baletiballo's avatar baletiballo
Browse files

waitingForLocalMMT now prints correct debug statements

It now logs it`ll wait *before* waiting, and "Preparing game now" once the connection is established.
parent 10a81171
No related branches found
No related tags found
No related merge requests found
...@@ -23,30 +23,29 @@ void PrepareGame() ...@@ -23,30 +23,29 @@ void PrepareGame()
{ {
CommunicationEvents.ServerAdress = "http://" + CommunicationEvents.ServerAddressLocal; //ServerAddress needs the "http://" CommunicationEvents.ServerAdress = "http://" + CommunicationEvents.ServerAddressLocal; //ServerAddress needs the "http://"
//UnityEngine.Debug.Log("StartMainMenu"); //UnityEngine.Debug.Log("StartMainMenu");
// TODO: Display "Loading in progress" to the player
SceneManager.LoadScene("MainMenu"); SceneManager.LoadScene("MainMenu");
} }
} }
IEnumerator ServerRoutine() IEnumerator ServerRoutine()
{
while (true)
{ {
yield return ServerSlots[ServerSlot.localServer].UpdateServerStatus(skipIfAlreadyChecked: false); yield return ServerSlots[ServerSlot.localServer].UpdateServerStatus(skipIfAlreadyChecked: false);
// The address of the localServer currently cannot change, so it is never empty/illegal // The address of the localServer currently cannot change, so it is never empty/illegal
// If this can happen in the future, this condition may not suffice // If this can happen in the future, this condition may not suffice
if (ServerSlots[ServerSlot.localServer].currentStatus == ServerStatus.online) while (ServerSlots[ServerSlot.localServer].currentStatus != ServerStatus.online)
{ {
CommunicationEvents.ServerRunning = true; Debug.Log("Local MMT Server not ready yet\n Will try again in 2 sec.");
PrepareGame();
}
//Wait for 2 seconds
yield return new WaitForSecondsRealtime(2f); yield return new WaitForSecondsRealtime(2f);
print("waiting"); yield return ServerSlots[ServerSlot.localServer].UpdateServerStatus(skipIfAlreadyChecked: false);
} }
Debug.Log("Preparing game now");
CommunicationEvents.ServerRunning = true;
// Give Unity time to flush the debug log
yield return new WaitForSecondsRealtime(0.1f);
PrepareGame();
} }
public UnityWebRequest pingL() public UnityWebRequest pingL()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment