Пример #1
0
        public void SetStats(PublicSummoner summoner, SummonerLeaguesDTO leagueInfo, PlayerLifetimeStats stats)
        {
            if (summoner == null || stats == null)
                return;

            if (InvokeRequired)
            {
                Invoke(new Action<PublicSummoner, SummonerLeaguesDTO, PlayerLifetimeStats>(SetStats), summoner, leagueInfo, stats);
                return;
            }

            RemoveAll(p => (p.Tag as string) == "Stats");

            var nameMap = new Dictionary<string, string>()
            {
                {"RankedSolo5x5", "RANKED_SOLO_5x5"},
                {"RankedTeam5x5", "RANKED_TEAM_5x5"},
                {"RankedTeam3x3", "RANKED_TEAM_3x3"}
            };

            foreach (var stat in stats.PlayerStatSummaries.PlayerStatSummarySet)
            {
                var sc = new StatsControl { Dock = DockStyle.Fill, Tag = "Stats" };

                Dictionary<string, object> queueInfo = null;
                if (leagueInfo != null)
                {
                    string queueType;
                    if (nameMap.TryGetValue(stat.PlayerStatSummaryTypeString, out queueType))
                    {
                        queueInfo = leagueInfo.GetQueueByName(queueType);
                    }
                }

                sc.SetStatSummary(stat, SummonerLeaguesDTO.GetRanking(queueInfo));

                var tab = new TabPage(MinifyStatType(stat.PlayerStatSummaryType))
                {
                    BackColor = this.BackColor,
                    Tag = "Stats"
                };
                tab.Controls.Add(sc);
                AddTab(tab);
            }
        }
Пример #2
0
        public void SetLeagueInfo(SummonerLeaguesDTO leagueInfo)
        {
            if (InvokeRequired)
            {
                Invoke(new Action<SummonerLeaguesDTO>(SetLeagueInfo), leagueInfo);
                return;
            }

            if (leagueInfo == null)
            {
                SetRanking("???");
            }
            else
            {
                Dictionary<string, object> queueInfo = leagueInfo.GetQueueByName("RANKED_SOLO_5x5");
                SetRanking(SummonerLeaguesDTO.GetRanking(queueInfo));
            }
        }