Ejemplo n.º 1
0
        public General(BaseModelView viewManager)
        {
            InitializeComponent();
            this.DataContext = viewManager;

            if (viewManager.LeagueEntry.FreshBlood)
            {
                Badges.Children.Add(new Badge("FRESHMAN", MaterialDesignThemes.Wpf.PackIconKind.NewBox));
            }
            if (viewManager.LeagueEntry.Veteran)
            {
                Badges.Children.Add(new Badge("VETERAN", MaterialDesignThemes.Wpf.PackIconKind.ShieldStar));
            }
            if (viewManager.LeagueEntry.HotStreak)
            {
                Badges.Children.Add(new Badge("WINSTREAK", MaterialDesignThemes.Wpf.PackIconKind.Fire));
            }
            if (viewManager.LeagueEntry.MiniSeries != null)
            {
                Badges.Children.Add(new Badge("SERIES", MaterialDesignThemes.Wpf.PackIconKind.SmileyCool));
            }
            if (viewManager.LeagueEntry.Tier.Equals("Unranked"))
            {
                if (viewManager.SummonerEntry.SummonerLevel < 30)
                {
                    Badges.Children.Add(new Badge("AMATEUR", MaterialDesignThemes.Wpf.PackIconKind.BookOpenPageVariant));
                }
                else
                {
                    Badges.Children.Add(new Badge("NEWBIE", MaterialDesignThemes.Wpf.PackIconKind.BookOpenPageVariant));
                }
            }
        }
Ejemplo n.º 2
0
 public ChampionMastery(BaseModelView viewManager)
 {
     InitializeComponent();
     this.DataContext = viewManager;
     for (int i = 0; i < viewManager.ChampionMasteryEntry.Count; i++)
     {
         BestChamps.Children.Add(new ChampMasteryField(viewManager.ChampNames[i],
                                                       viewManager.ChampionMasteryEntry[i].ChampionPoints,
                                                       viewManager.ChampionMasteryEntry[i].ChampionLevel,
                                                       i));
     }
 }
Ejemplo n.º 3
0
        public Leaderboard(BaseModelView viewManager)
        {
            InitializeComponent();
            this.DataContext = viewManager;

            for (int i = 0; i < 8; i++)
            {
                lbEntries.Children.Add(
                    new LeaderboardField(viewManager.ChallengerRanking[i].SummonerName,
                                         viewManager.ChallengerRanking[i].Wins,
                                         viewManager.ChallengerRanking[i].Losses,
                                         viewManager.ChallengerRanking[i].LeaguePoints,
                                         i + 1));
            }
        }
Ejemplo n.º 4
0
        public MatchHistory(BaseModelView viewManager)
        {
            InitializeComponent();
            this.DataContext = viewManager;

            for (int i = 0; i < viewManager.MatchEntries.Count; i++)
            {
                int      champId    = viewManager.MatchlistEntry.Matches[i].Champion;
                string   champName  = viewManager.FullChampionNames[champId.ToString()];
                string   posName    = viewManager.MatchlistEntry.Matches[i].Lane;
                string   roleName   = viewManager.MatchlistEntry.Matches[i].Role;
                int      queueId    = viewManager.MatchlistEntry.Matches[i].Queue;
                Queues   gameQueue  = viewManager.AllQueuesList.Where(p => p.QueueId == queueId).FirstOrDefault();
                string   mapName    = gameQueue.Map;
                DateTime startDate  = DateTimeOffset.FromUnixTimeMilliseconds(viewManager.MatchlistEntry.Matches[i].Timestamp).UtcDateTime;
                int      daysAgo    = (DateTime.Now - startDate).Days;
                string   playedWhen = "";
                if (daysAgo < 1)
                {
                    playedWhen = (DateTime.Now - startDate).Hours.ToString() + " hour(s) ago";
                }
                else
                {
                    playedWhen = daysAgo.ToString() + " day(s) ago";
                }

                long   gameId          = viewManager.MatchlistEntry.Matches[i].GameId;
                long   gameDurationSec = viewManager.MatchEntries[i].GameDuration;
                int    minutes         = (int)(gameDurationSec / 60);
                int    sec             = (int)(gameDurationSec - 60 * minutes);
                string gameDuration    = minutes.ToString() + "min " + sec.ToString() + "sec";

                ParticipantDto player = viewManager.MatchEntries[i].Participants.Where(p => p.ChampionId == champId).FirstOrDefault();
                TeamStatsDto   team   = viewManager.MatchEntries[i].Teams.Where(p => p.TeamId == player.TeamId).FirstOrDefault();
                string         result = team.Win.ToUpper();
                string         stats  = player.Stats.Kills.ToString() + "/" + player.Stats.Deaths.ToString() + "/" + player.Stats.Assists.ToString();

                spMatchHistory.Children.Add(new MatchHistoryField(champName, posName, roleName, mapName,
                                                                  playedWhen, gameDuration, result, stats));
            }
        }