using System; using LitJson; namespace Wizard; public class ReplayInfoItem { public BattleParameter BattleParameter; public long BattleId; public string OpponentName; public int ClassId; public int SubClassId; public int OpponentClassId; public int OpponentSubClassId; public int CharaId; public int OpponentCharaId; public string OpponentCountryCode; public string OpponentEmblemId; public string OpponentDegreeId; public bool IsWin; public DateTime BattleStartTime; public Format BattleFormat { get; set; } public string OpponentRotationId { get; private set; } public string RotationId { get; private set; } public ReplayInfoItem(JsonData data) { BattleParameter = BattleParameter.JsonToBattleParameter(data); BattleId = data["battle_id"].ToLong(); OpponentName = data["opponent_name"].ToString(); ClassId = data["class_id"].ToInt(); SubClassId = data.GetValueOrDefault("sub_class_id", 10); OpponentClassId = data["opponent_class_id"].ToInt(); OpponentSubClassId = data.GetValueOrDefault("opponent_sub_class_id", 10); CharaId = data.GetValueOrDefault("chara_id", 0); OpponentCharaId = data.GetValueOrDefault("opponent_chara_id", 0); OpponentCountryCode = data["opponent_country_code"].ToString(); OpponentEmblemId = data["opponent_emblem_id"].ToString(); OpponentDegreeId = data["opponent_degree_id"].ToString(); IsWin = data["is_win"].ToString().Equals("1"); BattleStartTime = DateTime.Parse(data["battle_start_time"].ToString()); BattleFormat = Data.ParseApiFormat(data["deck_format"].ToInt()); OpponentRotationId = data.GetValueOrDefault("opponent_rotation_id", null); RotationId = data.GetValueOrDefault("rotation_id", null); } }