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
Branches
No related tags found
No related merge requests found
......@@ -23,30 +23,29 @@ void PrepareGame()
{
CommunicationEvents.ServerAdress = "http://" + CommunicationEvents.ServerAddressLocal; //ServerAddress needs the "http://"
//UnityEngine.Debug.Log("StartMainMenu");
// TODO: Display "Loading in progress" to the player
SceneManager.LoadScene("MainMenu");
}
}
IEnumerator ServerRoutine()
{
while (true)
{
yield return ServerSlots[ServerSlot.localServer].UpdateServerStatus(skipIfAlreadyChecked: false);
// 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 (ServerSlots[ServerSlot.localServer].currentStatus == ServerStatus.online)
{
CommunicationEvents.ServerRunning = true;
PrepareGame();
}
yield return ServerSlots[ServerSlot.localServer].UpdateServerStatus(skipIfAlreadyChecked: false);
//Wait for 2 seconds
// 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
while (ServerSlots[ServerSlot.localServer].currentStatus != ServerStatus.online)
{
Debug.Log("Local MMT Server not ready yet\n Will try again in 2 sec.");
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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment