/// <summary> /// Creates a new instance based on the given information coming in from the server. /// </summary> public TurnBasedMatch(JSONDict matchInfo) : base(matchInfo) { IsMatchOver = matchInfo.SafeGetBoolValue("isGameComplete"); TimeTournamentBegan = matchInfo.SafeGetUnixDateTimeValue("tournamentBeganDate"); TimeLastTurnCompleted = matchInfo.SafeGetUnixDateTimeValue("lastTurnCompletedDate"); PrizeZ = matchInfo.SafeGetUintValue("prizePoints"); PrizeCash = matchInfo.SafeGetDoubleValue("prizeCash"); CurrentTurnIndex = matchInfo.SafeGetIntValue("currentTurnIndex"); Rounds = new List <TurnBasedRound>(); object roundsObj = matchInfo.SafeGetValue("roundInformation"); if (roundsObj != null && roundsObj.GetType() == typeof(List <object>)) { List <object> rounds = (List <object>)roundsObj; foreach (object round in rounds) { if (round != null && round.GetType() == typeof(JSONDict)) { JSONDict roundDict = (JSONDict)round; TurnBasedRound roundData = new TurnBasedRound(roundDict); Rounds.Add(roundData); } } } ContinueMatchData = new ContinuedTurnBasedMatch(matchInfo); }
/// <summary> /// Creates a new instance based on the given information coming in from the server. /// </summary> public TurnBasedMatch(JSONDict matchInfo) : base(matchInfo) { IsMatchOver = matchInfo.SafeGetBoolValue("isGameComplete"); TimeTournamentBegan = matchInfo.SafeGetUnixDateTimeValue("tournamentBeganDate"); TimeLastTurnCompleted = matchInfo.SafeGetUnixDateTimeValue("lastTurnCompletedDate"); PrizeZ = matchInfo.SafeGetUintValue("prizePoints"); PrizeCash = matchInfo.SafeGetDoubleValue("prizeCash"); CurrentTurnIndex = matchInfo.SafeGetIntValue("currentTurnIndex"); Rounds = new List<TurnBasedRound>(); object roundsObj = matchInfo.SafeGetValue("roundInformation"); if (roundsObj != null && roundsObj.GetType() == typeof(List<object>)) { List<object> rounds = (List<object>)roundsObj; foreach (object round in rounds) { if (round != null && round.GetType() == typeof(JSONDict)) { JSONDict roundDict = (JSONDict)round; TurnBasedRound roundData = new TurnBasedRound(roundDict); Rounds.Add(roundData); } } } ContinueMatchData = new ContinuedTurnBasedMatch(matchInfo); }