using System; using System.Collections.Generic; using Newtonsoft.Json; [Serializable] [JsonObject] public class Room { public string code; public Dictionary questions; public Dictionary players; public int currentQuestion; public double creationDate; public int currentState; public Room(string _code) { code = _code; creationDate = DateTime.Now.ToOADate(); players = new Dictionary(); questions = new Dictionary(); currentQuestion = 0; currentState = 1; //default by PC } public List GetPlayerList() { return new List(players.Values); } public List GetQuestionList() { return new List(questions.Values); } public List GetPropositionsByPlayer(Player player) { List propositions = new(); foreach (Question question in GetQuestionList()) { foreach (Proposition proposition in new List(question.propositions.Values)) { if (proposition.owner.id == player.id) { propositions.Add(proposition); break; } } } return propositions; } public void setPlayersAreReady(int _state) { currentState = _state; } }