fix: correct pages should toggle at correct time

This commit is contained in:
Fangh 2024-02-04 13:32:08 +01:00
parent 211aa89485
commit 764a39d053

View File

@ -340,56 +340,70 @@ private void OnNewGameState()
{
case (int)GameState.EnteringName:
{
WaitingOtherPlayers.SetActive(false);
BeforeStart.SetActive(false);
TakePicture.SetActive(false);
VotePicture.SetActive(false);
EndGame.SetActive(false);
HomeConnection.SetActive(true);
break;
}
case (int)GameState.Explanation:
{
Debug.Log("Explanation time.", this);
EndGame.SetActive(false);
WaitingOtherPlayers.SetActive(false);
TakePicture.SetActive(false);
WaitingRoom.SetActive(false);
VotePicture.SetActive(false);
EndGame.SetActive(false);
BeforeStart.SetActive(true);
endOfViewDate = DateTime.Now.AddSeconds(4);
break;
}
case (int)GameState.MakeProposition:
{
if (BeforeStart.activeInHierarchy)
{
Debug.Log("It's photo time !", this);
WaitingOtherPlayers.SetActive(false);
BeforeStart.SetActive(false);
WaitingRoom.SetActive(false);
VotePicture.SetActive(false);
EndGame.SetActive(false);
TakePicture.SetActive(true);
endOfViewDate = DateTime.Now.AddSeconds(60);
}
break;
}
case (int)GameState.MakeVote:
{
if (TakePicture.activeInHierarchy || WaitingOtherPlayers.activeInHierarchy)
{
Debug.Log("It's voting time !", this);
WaitingOtherPlayers.SetActive(false);
BeforeStart.SetActive(false);
WaitingRoom.SetActive(false);
TakePicture.SetActive(false);
EndGame.SetActive(false);
VotePicture.SetActive(true);
myOnlineRoom.Child("currentQuestionId").ValueChanged += OnCurrentQuestionChanged;
}
break;
}
case (int)GameState.Score:
{
if (VotePicture.activeInHierarchy || WaitingOtherPlayers.activeInHierarchy)
{
Debug.Log("it's scoring time !", this);
myOnlineRoom.Child("currentQuestionId").ValueChanged -= OnCurrentQuestionChanged;
VotePicture.SetActive(false);
WaitingOtherPlayers.SetActive(false);
BeforeStart.SetActive(false);
WaitingRoom.SetActive(false);
TakePicture.SetActive(false);
VotePicture.SetActive(false);
EndGame.SetActive(true);
endGameFirstPlayer.SetActive(CheckIfIAmTheFirst(myRoom.GetPlayerList()));
endGameOtherPlayers.SetActive(!CheckIfIAmTheFirst(myRoom.GetPlayerList()));
EndGame.SetActive(true);
}
break;
}