Пример #1
0
        private Player ReadPlayerFromJson(JToken json)
        {
            string summonerName = (string)json["summonerName"];
            string team         = (string)json["team"];
            int    skinId       = (int)json["skinID"];
            string position     = (string)json["position"];
            Score  score        = ReadFromJson <Score>(json["scores"]);

            string championName = (string)json["championName"];
            int    level        = (int)json["level"];

            Item[]          items          = ReadItemsFromJson(json["items"]);
            SummonerSpell[] summonerSpells = ReadSummsFromJson(json["summonerSpells"]);
            summonerSpells[0] = ReadFromJson <SummonerSpell>(json["summonerSpells"]["summonerSpellOne"]);
            summonerSpells[1] = ReadFromJson <SummonerSpell>(json["summonerSpells"]["summonerSpellTwo"]);
            BasicRunes basicRunes = ReadBasicRunesFromJson(json["runes"]);

            bool   isDead       = (bool)json["isDead"];
            double respawnTimer = (double)json["respawnTimer"];
            bool   isBot        = (bool)json["isBot"];

            string rawChamp = (string)json["rawChampionName"];

            return(new Player(
                       summonerName, team, skinId, position, score,
                       championName, level, items, summonerSpells, basicRunes,
                       isDead, respawnTimer, isBot, rawChamp
                       ));
        }
Пример #2
0
 public Player(
     string summonerName, string team, int skinId, string position, Score score,
     string championName, int level, Item[] items, SummonerSpell[] summonerSpells, BasicRunes basicRunes,
     bool isDead, double respawnTimer, bool isBot,
     string rawChampionName)
 {
     this.summonerName    = summonerName;
     this.team            = team;
     this.skinId          = skinId;
     this.position        = position;
     this.score           = score;
     this.championName    = championName;
     this.level           = level;
     this.items           = items;
     this.summonerSpells  = summonerSpells;
     this.basicRunes      = basicRunes;
     this.isDead          = isDead;
     this.respawnTimer    = respawnTimer;
     this.isBot           = isBot;
     this.rawChampionName = rawChampionName;
 }