void Reader_ObjectRead(object obj)
        {
            if (obj is GameDTO)
            {
                CurrentGame = (GameDTO)obj;

                string team = "";

                foreach (PlayerParticipant p in CurrentGame.TeamOne)
                {
                    team += p.Name + ", ";
                }

                if (team != "")
                    team = team.Remove(team.Length - 3);

                UpdateTeam(team, 1);

                // Keep it DRY ya'll
                team = "";

                foreach (PlayerParticipant p in CurrentGame.TeamTwo)
                {
                    team += p.Name + ", ";
                }

                if (team != "")
                    team = team.Remove(team.Length - 3);

                UpdateTeam(team, 2);

                UpdateMap(CurrentGame.MapId);
            }
            else if (obj is EndOfGameStats)
            {
                return;
            }
            else if (obj is List<ChampionDTO>)
            {
                Champions = (List<ChampionDTO>)obj;
            }
            else if (obj is LoginDataPacket)
            {
                SelfSummoner = ((LoginDataPacket)obj).AllSummonerData.Summoner;
            }
        }
Esempio n. 2
0
        void Reader_ObjectRead(object obj)
        {
            if (obj is GameDTO)
            {
                CurrentGame = (GameDTO)obj;

                List<GgPlayer> team1 = new List<GgPlayer>();

                foreach (PlayerParticipant p in CurrentGame.TeamOne)
                {
                    team1.Add(new GgPlayer() { Name = p.Name, SummonerId = p.SummonerId, AccountId = p.AccountId });
                }

                UpdateTeam(team1, 1);

                List<GgPlayer> team2 = new List<GgPlayer>();

                foreach (PlayerParticipant p in CurrentGame.TeamTwo)
                {
                    team2.Add(new GgPlayer() { Name = p.Name, SummonerId = p.SummonerId, AccountId = p.AccountId });
                }

                UpdateTeam(team2, 2);

                UpdateMap(CurrentGame.MapId);
            }
            else if (obj is EndOfGameStats)
            {
                return;
            }
            else if (obj is List<ChampionDTO>)
            {
                Champions = (List<ChampionDTO>)obj;
            }
            else if (obj is LoginDataPacket)
            {
                SelfSummoner = ((LoginDataPacket)obj).AllSummonerData.Summoner;
            }
        }