public GameState(JObject gameState) { //Players = JsonConvert.DeserializeObject<List<Player>>(gameState["players"].ToString()); var players = JsonConvert.DeserializeObject<IEnumerable<object>>(gameState["players"].ToString()); Players = new List<Player>(); foreach (var player in players) { var p = new Player(JObject.Parse(player.ToString())); Players.Add(p); } TournamentId = gameState["tournament_id"].ToString(); GameId = gameState["game_id"].ToString(); Round = Convert.ToInt32(gameState["round"].ToString()); BetIndex = Convert.ToInt32(gameState["bet_index"].ToString()); SmallBlind = Convert.ToInt32(gameState["small_blind"].ToString()); Orbits = Convert.ToInt32(gameState["orbits"].ToString()); Dealer = gameState["dealer"].ToString(); CommunityCards = JsonConvert.DeserializeObject<List<Card>>(gameState["community_cards"].ToString()); CurrentBuyIn = Convert.ToInt32(gameState["current_buy_in"].ToString()); Pot = Convert.ToInt32(gameState["pot"].ToString()); InAction = Convert.ToInt32(gameState["in_action"].ToString()); MinimumRaise = Convert.ToInt32(gameState["minimum_raise"].ToString()); }
public Player GetCurrentPlayer() { return _me ?? (_me = Players.ElementAt(InAction)); }