Exemple #1
0
        private void SkinSelectListView_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            var item = sender as ListViewItem;

            if (item != null)
            {
                if (item.Tag != null)
                {
                    championSkins skin = championSkins.GetSkin((int)item.Tag);
                    SkinName.Content = skin.displayName;
                    DoubleAnimation fadingAnimation = new DoubleAnimation();
                    fadingAnimation.From       = 1;
                    fadingAnimation.To         = 0;
                    fadingAnimation.Duration   = new Duration(TimeSpan.FromSeconds(0.2));
                    fadingAnimation.Completed += (eSender, eArgs) =>
                    {
                        string uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", skin.splashPath);
                        ChampionImage.Source     = Client.GetImage(uriSource);
                        fadingAnimation          = new DoubleAnimation();
                        fadingAnimation.From     = 0;
                        fadingAnimation.To       = 1;
                        fadingAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.5));

                        ChampionImage.BeginAnimation(Image.OpacityProperty, fadingAnimation);
                    };

                    ChampionImage.BeginAnimation(Image.OpacityProperty, fadingAnimation);
                }
            }
        }
Exemple #2
0
        private void FilterSkins()
        {
            SkinSelectListView.Items.Clear();

            List <ChampionDTO>     tempList = ChampionList.ToList();
            List <ChampionSkinDTO> skinList = new List <ChampionSkinDTO>();

            foreach (ChampionDTO champion in tempList)
            {
                skinList.AddRange(champion.ChampionSkins);
            }

            if (!String.IsNullOrEmpty(SearchTextBox.Text) && !LimitedSkinCheckBox.IsChecked.Value)
            {
                skinList = skinList.Where(x => championSkins.GetSkin(x.SkinId).displayName.ToLower().Contains(SearchTextBox.Text.ToLower())).ToList();
            }

            foreach (ChampionSkinDTO skin in skinList)
            {
                if (LimitedSkinCheckBox.IsChecked.Value ? !skin.StillObtainable && skin.Owned : skin.Owned)
                {
                    ProfileSkinImage skinImage    = new ProfileSkinImage();
                    championSkins    championSkin = championSkins.GetSkin(skin.SkinId);
                    var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", championSkins.GetSkin(skin.SkinId).portraitPath), UriKind.Absolute);
                    skinImage.SkinImage.Source = new BitmapImage(uriSource);
                    if (!skin.StillObtainable)
                    {
                        skinImage.LimitedLabel.Visibility = System.Windows.Visibility.Visible;
                    }
                    skinImage.SkinName.Content = championSkin.displayName;
                    skinImage.Margin           = new System.Windows.Thickness(5, 0, 5, 0);
                    SkinSelectListView.Items.Add(skinImage);
                }
            }
        }
Exemple #3
0
        private async void SkinSelectListView_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            var item = sender as ListViewItem;

            if (item != null)
            {
                if (item.Tag != null)
                {
                    if (item.Tag is string)
                    {
                        string[]  splitItem  = ((string)item.Tag).Split(':');
                        int       championId = Convert.ToInt32(splitItem[1]);
                        champions Champion   = champions.GetChampion(championId);
                        await Client.PVPNet.SelectChampionSkin(championId, 0);

                        TextRange tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd);
                        tr.Text = "Selected Default " + Champion.name + " as skin" + Environment.NewLine;
                        tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.White);
                    }
                    else
                    {
                        championSkins skin = championSkins.GetSkin((int)item.Tag);
                        await Client.PVPNet.SelectChampionSkin(skin.championId, skin.id);

                        TextRange tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd);
                        tr.Text = "Selected " + skin.displayName + " as skin" + Environment.NewLine;
                        tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.White);
                    }
                }
            }
        }
 private void SkinSelectListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (SkinSelectListView.SelectedIndex != -1)
     {
         ProfileSkinImage selectedSkin = (ProfileSkinImage)SkinSelectListView.SelectedItem;
         championSkins    skin         = (championSkins)selectedSkin.Tag;
         Client.OverlayContainer.Content    = new ChampionDetailsPage(skin.championId, skin.id).Content;
         Client.OverlayContainer.Visibility = Visibility.Visible;
     }
 }
Exemple #5
0
        public ChampionDetailsPage(int ChampionId, int SkinID)
        {
            InitializeComponent();
            RenderChampions(ChampionId);
            championSkins skin = championSkins.GetSkin(SkinID);

            SkinName.Content = skin.displayName;
            string uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", skin.splashPath);

            ChampionImage.Source = Client.GetImage(uriSource);
        }
Exemple #6
0
        private void RenderStats(EndOfGameStats Statistics)
        {
            TimeSpan t = TimeSpan.FromSeconds(Statistics.GameLength);

            TimeLabel.Content = string.Format("{0:D2}:{1:D2}", t.Minutes, t.Seconds);
            ModeLabel.Content = Statistics.GameMode;
            TypeLabel.Content = Statistics.GameType;

            GainedIP.Content = "+" + Statistics.IpEarned + " IP";
            TotalIP.Content  = Statistics.IpTotal.ToString().Replace(".0", "") + " IP Total";
            string game = " XP";


            List <PlayerParticipantStatsSummary> AllParticipants = new List <PlayerParticipantStatsSummary>(Statistics.TeamPlayerParticipantStats.ToArray());

            AllParticipants.AddRange(Statistics.OtherTeamPlayerParticipantStats);

            foreach (PlayerParticipantStatsSummary summary in AllParticipants)
            {
                EndOfGamePlayer playerStats = new EndOfGamePlayer();
                champions       Champ       = champions.GetChampion(summary.SkinName); //Misleading variable name
                playerStats.ChampImage.Source   = Champ.icon;
                playerStats.ChampLabel.Content  = Champ.name;
                playerStats.PlayerLabel.Content = summary.SummonerName;
                var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName((int)summary.Spell1Id)), UriKind.Absolute);
                playerStats.Spell1Image.Source = new BitmapImage(uriSource);
                uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName((int)summary.Spell2Id)), UriKind.Absolute);
                playerStats.Spell2Image.Source = new BitmapImage(uriSource);

                double ChampionsKilled = 0;
                double Assists         = 0;
                double Deaths          = 0;

                bool victory = false;
                foreach (RawStatDTO stat in summary.Statistics)
                {
                    if (stat.StatTypeName.ToLower() == "win")
                    {
                        victory = true;
                    }
                }

                if (Statistics.Ranked)
                {
                    game = " LP";

                    GainedXP.Content = (victory ? "+" : "-") + Statistics.ExperienceEarned + game;
                    TotalXP.Content  = Statistics.ExperienceTotal + game;
                }
                else
                {
                    GainedXP.Content = "+" + Statistics.ExperienceEarned + game;
                    TotalXP.Content  = Statistics.ExperienceTotal + game;
                }
                foreach (RawStatDTO stat in summary.Statistics)
                {
                    if (stat.StatTypeName.StartsWith("ITEM") && stat.Value != 0)
                    {
                        System.Windows.Controls.Image item = new System.Windows.Controls.Image();
                        uriSource   = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png"), UriKind.Absolute);
                        item.Source = new BitmapImage(uriSource);
                        playerStats.ItemsListView.Items.Add(item);
                    }

                    switch (stat.StatTypeName)
                    {
                    case "GOLD_EARNED":
                        if (stat.Value > 0)
                        {
                            playerStats.GoldLabel.Content = string.Format("{0:N1}k", stat.Value / 1000);
                        }
                        break;

                    case "MINIONS_KILLED":
                        playerStats.CSLabel.Content = stat.Value;
                        break;

                    case "LEVEL":
                        playerStats.LevelLabel.Content = stat.Value;
                        break;

                    case "CHAMPIONS_KILLED":
                        ChampionsKilled = stat.Value;
                        break;

                    case "ASSISTS":
                        Assists = stat.Value;
                        break;

                    case "NUM_DEATHS":
                        Deaths = stat.Value;
                        break;

                    default:
                        break;
                    }
                }

                playerStats.ScoreLabel.Content = ChampionsKilled + "/" + Deaths + "/" + Assists;

                PlayersListView.Items.Add(playerStats);
            }

            PlayersListView.Items.Insert(AllParticipants.Count / 2, new Separator());

            championSkins Skin = championSkins.GetSkin(Statistics.SkinIndex);

            try
            {
                if (Skin != null)
                {
                    var skinSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", Skin.splashPath), UriKind.Absolute);
                    SkinImage.Source = new BitmapImage(skinSource);
                }
            }
            catch
            {
            }
        }
Exemple #7
0
        private void RenderStats(EndOfGameStats statistics)
        {
            TimeSpan t = TimeSpan.FromSeconds(statistics.GameLength);

            TimeLabel.Content = string.Format("{0:D2}:{1:D2}", t.Minutes, t.Seconds);
            ModeLabel.Content = statistics.GameMode;
            TypeLabel.Content = statistics.GameType;
            MatchStatsOnline  = "http://matchhistory.na.leagueoflegends.com/en/#match-details/" + Client.Region.InternalName + "/" + statistics.ReportGameId + "/" + statistics.UserId;
            GainedIP.Content  = "+" + statistics.IpEarned + " IP";
            TotalIP.Content   = statistics.IpTotal.ToString(CultureInfo.InvariantCulture).Replace(".0", "") + " IP Total";
            string game            = " XP";
            var    allParticipants =
                new List <PlayerParticipantStatsSummary>(statistics.TeamPlayerParticipantStats.ToArray());

            allParticipants.AddRange(statistics.OtherTeamPlayerParticipantStats);
            foreach (PlayerParticipantStatsSummary summary in allParticipants)
            {
                var       playerStats = new EndOfGamePlayer(summary.UserId, summary.GameId, summary.SummonerName, statistics.TeamPlayerParticipantStats.Contains(summary));
                champions champ       = champions.GetChampion(summary.SkinName); //Misleading variable name
                playerStats.ChampImage.Source   = champ.icon;
                playerStats.ChampLabel.Content  = champ.name;
                playerStats.PlayerLabel.Content = summary.SummonerName;
                if (File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName((int)summary.Spell1Id))))
                {
                    var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName((int)summary.Spell1Id)), UriKind.Absolute);
                    playerStats.Spell1Image.Source = new BitmapImage(uriSource);
                }
                else
                {
                    Client.Log(SummonerSpell.GetSpellImageName((int)summary.Spell1Id) + " is missing");
                }
                if (File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName((int)summary.Spell2Id))))
                {
                    var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName((int)summary.Spell2Id)), UriKind.Absolute);
                    playerStats.Spell2Image.Source = new BitmapImage(uriSource);
                }
                else
                {
                    Client.Log(SummonerSpell.GetSpellImageName((int)summary.Spell2Id) + " is missing");
                }
                double championsKilled = 0;
                double assists         = 0;
                double deaths          = 0;
                bool   victory         = false;
                foreach (RawStatDTO stat in summary.Statistics.Where(stat => stat.StatTypeName.ToLower() == "win"))
                {
                    victory = true;
                }

                if (statistics.Ranked)
                {
                    game             = " LP";
                    GainedXP.Content = (victory ? "+" : "-") + statistics.ExperienceEarned + game;
                    TotalXP.Content  = statistics.ExperienceTotal + game;
                }
                else
                {
                    GainedXP.Content = "+" + statistics.ExperienceEarned + game;
                    TotalXP.Content  = statistics.ExperienceTotal + game;
                }

                foreach (RawStatDTO stat in summary.Statistics)
                {
                    if (stat.StatTypeName.StartsWith("ITEM") && Math.Abs(stat.Value) > 0)
                    {
                        var item = new Image();
                        if (File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")))
                        {
                            var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png"), UriKind.Absolute);
                            item.Source = new BitmapImage(uriSource);
                        }
                        else
                        {
                            Client.Log(stat.Value + ".png is missing");
                        }
                        playerStats.ItemsListView.Items.Add(item);
                    }
                    switch (stat.StatTypeName)
                    {
                    case "GOLD_EARNED":
                        if (stat.Value > 0)
                        {
                            playerStats.GoldLabel.Content = string.Format("{0:N1}k", stat.Value / 1000);
                        }
                        break;

                    case "MINIONS_KILLED":
                        playerStats.CsLabel.Content = stat.Value;
                        break;

                    case "LEVEL":
                        playerStats.LevelLabel.Content = stat.Value;
                        break;

                    case "CHAMPIONS_KILLED":
                        championsKilled = stat.Value;
                        break;

                    case "ASSISTS":
                        assists = stat.Value;
                        break;

                    case "NUM_DEATHS":
                        deaths = stat.Value;
                        break;
                    }
                }
                playerStats.ScoreLabel.Content = championsKilled + "/" + deaths + "/" + assists;
                PlayersListView.Items.Add(playerStats);
            }
            PlayersListView.Items.Insert(allParticipants.Count / 2, new Separator());
            championSkins skin = championSkins.GetSkin(statistics.SkinIndex);

            try
            {
                if (skin == null)
                {
                    return;
                }

                var skinSource =
                    new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", skin.splashPath),
                            UriKind.Absolute);
                SkinImage.Source = new BitmapImage(skinSource);
            }
            catch (Exception)
            {
            }
        }