fix(gamemanager): explanationpage is stuck

This commit is contained in:
Fangh 2024-02-29 22:40:18 +01:00
parent c69c92d733
commit d9580450cc
1 changed files with 5 additions and 13 deletions

View File

@ -282,17 +282,9 @@ public class GameManager : MonoBehaviour
public void StartGame()
{
// send Start Game
string JSON = JsonUtility.ToJson(myRoom);
Debug.Log(JSON);
try
{
SendCurrentState(GameState.Explanation, () =>
{
Debug.Log($"start the game", this);
WaitingRoom.SetActive(false);
BeforeStart.SetActive(true);
});
SendCurrentState(GameState.Explanation);
}
catch (Exception ex)
{
@ -473,7 +465,8 @@ public class GameManager : MonoBehaviour
}
return isFirst;
}
public void SendCurrentState(GameState state, Action callback_oncCurrentStateSent)
public void SendCurrentState(GameState state, Action callback_onCurrentStateSent = null)
{
myOnlineRoom.Child("currentState").SetValueAsync((int)state).ContinueWithOnMainThread(task =>
{
@ -483,10 +476,9 @@ public class GameManager : MonoBehaviour
}
else
{
callback_oncCurrentStateSent?.Invoke();
callback_onCurrentStateSent?.Invoke();
}
}); ;
});
}
public void OnClickSubmitSignIn()