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