From 981213e6ae5fbab4b5206571496c991985fd59ee Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 28 Jan 2024 18:12:05 +0100 Subject: [PATCH] fix timer --- Assets/Scripts/PropositionFrame.cs | 2 +- Assets/Scripts/RoomManager.cs | 1 + Assets/Scripts/VotingPage.cs | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/PropositionFrame.cs b/Assets/Scripts/PropositionFrame.cs index ec6c7a4..f03cd2a 100644 --- a/Assets/Scripts/PropositionFrame.cs +++ b/Assets/Scripts/PropositionFrame.cs @@ -20,7 +20,7 @@ public class PropositionFrame : MonoBehaviour public void Initialize(Proposition _proposition) { - Debug.Log($"Initializing {_proposition.owner}'s proposition", this); + Debug.Log($"Initializing {_proposition.owner.name}'s proposition", this); proposition = _proposition; playerName.text = proposition.owner.name; diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index d592699..e96f6bd 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -398,6 +398,7 @@ private void CheckPlayersPropositions() foreach (var propositionsByPlayer in propositionsPerPlayers) { + Debug.Log("proposition"); foreach (Proposition p in propositionsByPlayer.Value) { if (string.IsNullOrEmpty(p.photoUrl)) diff --git a/Assets/Scripts/VotingPage.cs b/Assets/Scripts/VotingPage.cs index 5ddb69f..c857031 100644 --- a/Assets/Scripts/VotingPage.cs +++ b/Assets/Scripts/VotingPage.cs @@ -40,7 +40,8 @@ private void Update() if (DateTime.Now < endOfTimer) { - timerLabel.text = (endOfTimer - DateTime.Now).TotalSeconds.ToString("D2"); + TimeSpan duration = endOfTimer - DateTime.Now; + timerLabel.text = ((int)duration.TotalSeconds).ToString("D2"); } else { @@ -130,6 +131,9 @@ private void OnQuestionChanged(object sender, ValueChangedEventArgs _questionRef private void UpdateVoters() { + if (currentQuestion.propositions.Count == 0) //manage if there is no propositons + return; + if (currentQuestion.propositions[0] != null) { List playersThatHasVotedForFirstProposition = new List();