fix: manage when no propositions
This commit is contained in:
parent
0876f685d8
commit
1a724ac03c
@ -38,7 +38,11 @@ private void Update()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
if (endOfTimer <= DateTime.Now)
|
if (DateTime.Now < endOfTimer)
|
||||||
|
{
|
||||||
|
timerLabel.text = (DateTime.Now - endOfTimer).TotalSeconds.ToString("D2");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
timerLabel.text = "0";
|
timerLabel.text = "0";
|
||||||
if (remainingQuestions.Count > 0)
|
if (remainingQuestions.Count > 0)
|
||||||
@ -51,10 +55,6 @@ private void Update()
|
|||||||
OnVoteEnded?.Invoke();
|
OnVoteEnded?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
timerLabel.text = (DateTime.Now - endOfTimer).ToString("D2");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,20 +129,25 @@ private void OnQuestionChanged(object sender, ValueChangedEventArgs _questionRef
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateVoters()
|
private void UpdateVoters()
|
||||||
|
{
|
||||||
|
if (currentQuestion.propositions[0] != null)
|
||||||
{
|
{
|
||||||
List<Player> playersThatHasVotedForFirstProposition = new List<Player>();
|
List<Player> playersThatHasVotedForFirstProposition = new List<Player>();
|
||||||
foreach (string playerId in currentQuestion.propositions[0].voters)
|
foreach (string playerId in currentQuestion.propositions[0].voters)
|
||||||
{
|
{
|
||||||
playersThatHasVotedForFirstProposition.Add(currentPlayers[playerId]);
|
playersThatHasVotedForFirstProposition.Add(currentPlayers[playerId]);
|
||||||
}
|
}
|
||||||
|
proposition1.UpdateVoters(playersThatHasVotedForFirstProposition);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentQuestion.propositions[1] != null)
|
||||||
|
{
|
||||||
List<Player> playersThatHasVotedForSecondProposition = new List<Player>();
|
List<Player> playersThatHasVotedForSecondProposition = new List<Player>();
|
||||||
foreach (string playerId in currentQuestion.propositions[1].voters)
|
foreach (string playerId in currentQuestion.propositions[1].voters)
|
||||||
{
|
{
|
||||||
playersThatHasVotedForSecondProposition.Add(currentPlayers[playerId]);
|
playersThatHasVotedForSecondProposition.Add(currentPlayers[playerId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
proposition1.UpdateVoters(playersThatHasVotedForFirstProposition);
|
|
||||||
proposition2.UpdateVoters(playersThatHasVotedForSecondProposition);
|
proposition2.UpdateVoters(playersThatHasVotedForSecondProposition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user