From 0014a2a05d3e67ea25505debc3fc95700d6fdc85 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 28 Jan 2024 16:52:13 +0100 Subject: [PATCH] fix somes things --- Assets/Scripts/RoomManager.cs | 2 +- Assets/Scripts/VotingPage.cs | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 791d374..ec727d8 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -428,7 +428,7 @@ private void CheckPlayersPropositions() { if (string.IsNullOrEmpty(p.photoUrl)) { - Debug.Log($"player {p.owner} has a proposition without an URL"); + Debug.Log($"player {p.owner.name} has a proposition without an URL"); allPlayersHasProposedTwoPictures = false; } } diff --git a/Assets/Scripts/VotingPage.cs b/Assets/Scripts/VotingPage.cs index 6ec4eea..88b9c28 100644 --- a/Assets/Scripts/VotingPage.cs +++ b/Assets/Scripts/VotingPage.cs @@ -133,21 +133,27 @@ private void UpdateVoters() if (currentQuestion.propositions[0] != null) { List playersThatHasVotedForFirstProposition = new List(); - foreach (string playerId in currentQuestion.propositions[0].voters) + if (currentQuestion.propositions[0].voters != null) { - playersThatHasVotedForFirstProposition.Add(currentPlayers[playerId]); + foreach (string playerId in currentQuestion.propositions[0].voters) + { + playersThatHasVotedForFirstProposition.Add(currentPlayers[playerId]); + } + proposition1.UpdateVoters(playersThatHasVotedForFirstProposition); } - proposition1.UpdateVoters(playersThatHasVotedForFirstProposition); } if (currentQuestion.propositions[1] != null) { List playersThatHasVotedForSecondProposition = new List(); - foreach (string playerId in currentQuestion.propositions[1].voters) + if (currentQuestion.propositions[0].voters != null) { - playersThatHasVotedForSecondProposition.Add(currentPlayers[playerId]); + foreach (string playerId in currentQuestion.propositions[1].voters) + { + playersThatHasVotedForSecondProposition.Add(currentPlayers[playerId]); + } + proposition2.UpdateVoters(playersThatHasVotedForSecondProposition); } - proposition2.UpdateVoters(playersThatHasVotedForSecondProposition); } } }