feat: add GetPropositionsByPlayer

This commit is contained in:
Michel Roux 2024-01-28 02:26:57 +01:00
parent 1df95d8eca
commit a9fd87527e

View File

@ -33,6 +33,25 @@ public List<Question> GetQuestionList()
return new List<Question>(questions.Values); return new List<Question>(questions.Values);
} }
public List<Proposition> GetPropositionsByPlayer(Player player)
{
List<Proposition> propositions = new();
foreach (Question question in GetQuestionList())
{
foreach (Proposition proposition in new List<Proposition>(question.propositions.Values))
{
if (proposition.owner.id == player.id)
{
propositions.Add(proposition);
break;
}
}
}
return propositions;
}
public void setPlayersAreReady(int _state) public void setPlayersAreReady(int _state)
{ {
currentState = _state; currentState = _state;