feat: cannot play under 3 players

This commit is contained in:
Fangh 2024-02-01 22:57:10 +01:00
parent a1dd3f0151
commit db56c69dd9

View File

@ -317,11 +317,13 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
{ {
case (int)GameState.WaitingForOtherPlayersToJoin: case (int)GameState.WaitingForOtherPlayersToJoin:
{ {
if(CheckIfIAmTheFirst(myRoom.GetPlayerList())) List<Player> players = myRoom.GetOrderedPlayerList();
UpdateDisplayedListUser(players);
if (players.Count >= 3 && CheckIfIAmTheFirst(players))
{ {
submitStartGame.SetActive(true); submitStartGame.SetActive(true);
} }
UpdateDisplayedListUser(myRoom.GetOrderedPlayerList());
break; break;
} }
default: default:
@ -509,13 +511,18 @@ private void OnCurrentQuestionChanged(object sender, ValueChangedEventArgs onlin
Question q = myRoom.questions[questionId]; Question q = myRoom.questions[questionId];
if (WaitingOtherPlayers.activeInHierarchy) //do not vote for your question
if(myRoom.GetQuestionsByPlayer(currentPlayer).Contains(q))
{ {
WaitingOtherPlayers.SetActive(false); WaitingOtherPlayers.SetActive(true);
VotePicture.SetActive(true); VotePicture.SetActive(false);
} }
else
{
VotePicture.SetActive(true);
WaitingOtherPlayers.SetActive(false);
VotePicture.GetComponent<PropositionHandler>().ShowQuestion(q); VotePicture.GetComponent<PropositionHandler>().ShowQuestion(q);
}
} }
/// <summary> /// <summary>