private void item_MouseDown(object sender, MouseButtonEventArgs e) { var item = (ReplayItem)sender; var stats = (EndOfReplayGameStats)item.Tag; selectedStats = stats; ReplayOverviewGrid.Visibility = Visibility.Visible; var fadeGridInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1)); ReplayOverviewGrid.BeginAnimation(OpacityProperty, fadeGridInAnimation); GameId.Content = stats.Difficulty; GameType.Content = stats.GameMode.ToLower(); double seconds = stats.GameLength % 60; double minutes = stats.GameLength / 60; GameTime.Content = string.Format("{0:0}:{1:00}", minutes, seconds); TeamOnePanel.Children.Clear(); TeamTwoPanel.Children.Clear(); foreach (ReplayParticipantStatsSummary summary in stats.TeamPlayerParticipantStats) { double k = -1, d = -1, a = -1; var player = new PlayerItemReplay { PlayerNameLabel = { Content = summary.SummonerName } }; foreach (ReplayRawStatDTO stat in summary.Statistics) { if (stat.StatTypeName.StartsWith("ITEM") && stat.Value != 0) { switch (stat.StatTypeName) { case "ITEM1": player.gameItem1.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM2": player.gameItem2.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM3": player.gameItem3.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM4": player.gameItem4.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM5": player.gameItem5.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM6": player.gameTrinket.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; } } switch (stat.StatTypeName) { case "CHAMPIONS_KILLED": k = stat.Value; break; case "NUM_DEATHS": d = stat.Value; break; case "ASSISTS": a = stat.Value; break; } } foreach ( object element in player.getChildElements() .Where( element => element is SmallChampionItem && ((SmallChampionItem)element).Name.StartsWith("game"))) { ((SmallChampionItem)element).MouseMove += img_MouseMove; ((SmallChampionItem)element).MouseLeave += img_MouseLeave; } player.ChampionIcon.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "champion", summary.SkinName + ".png")); player.File.Content = summary.SkinName; player.KDA.Content = k + "/" + d + "/" + a; TeamOnePanel.Children.Add(player); } foreach (ReplayParticipantStatsSummary summary in stats.OtherTeamPlayerParticipantStats) { double k = -1, d = -1, a = -1; var player = new PlayerItemReplay { PlayerNameLabel = { Content = summary.SummonerName } }; foreach (ReplayRawStatDTO stat in summary.Statistics) { if (stat.StatTypeName.StartsWith("ITEM") && stat.Value != 0) { switch (stat.StatTypeName) { case "ITEM1": player.gameItem1.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM2": player.gameItem2.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM3": player.gameItem3.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM4": player.gameItem4.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM5": player.gameItem5.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; case "ITEM6": player.gameTrinket.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png")); break; } } switch (stat.StatTypeName) { case "CHAMPIONS_KILLED": k = stat.Value; break; case "NUM_DEATHS": d = stat.Value; break; case "ASSISTS": a = stat.Value; break; } } foreach ( object element in player.getChildElements() .Where( element => element is SmallChampionItem && ((SmallChampionItem)element).Name.StartsWith("game"))) { ((SmallChampionItem)element).MouseMove += img_MouseMove; ((SmallChampionItem)element).MouseLeave += img_MouseLeave; } player.File.Content = summary.SkinName; player.ChampionIcon.ChampionImage.Source = Client.GetImage(Path.Combine(Client.ExecutingDirectory, "Assets", "champion", summary.SkinName + ".png")); player.KDA.Content = k + "/" + d + "/" + a; TeamTwoPanel.Children.Add(player); } }
void item_MouseDown(object sender, MouseButtonEventArgs e) { ReplayItem item = (ReplayItem)sender; EndOfGameStats stats = (EndOfGameStats)item.Tag; selectedStats = stats; ReplayOverviewGrid.Visibility = Visibility.Visible; var fadeGridInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1)); ReplayOverviewGrid.BeginAnimation(Grid.OpacityProperty, fadeGridInAnimation); GameId.Content = stats.Difficulty; GameType.Content = stats.GameMode.ToLower(); double seconds = stats.GameLength % 60; double minutes = stats.GameLength / 60; GameTime.Content = string.Format("{0:0}:{1:00}", minutes, seconds); TeamOnePanel.Children.Clear(); TeamTwoPanel.Children.Clear(); foreach (PlayerParticipantStatsSummary summary in stats.TeamPlayerParticipantStats) { PlayerItemReplay player = new PlayerItemReplay(); player.PlayerNameLabel.Content = summary.SummonerName; Uri UriSource = new Uri("/LegendaryReplays;component/champion/" + summary.SkinName + ".png", UriKind.RelativeOrAbsolute); player.ChampionIcon.ChampionImage.Source = new BitmapImage(UriSource); TeamOnePanel.Children.Add(player); } foreach (PlayerParticipantStatsSummary summary in stats.OtherTeamPlayerParticipantStats) { PlayerItemReplay player = new PlayerItemReplay(); player.PlayerNameLabel.Content = summary.SummonerName; Uri UriSource = new Uri("/LegendaryReplays;component/champion/" + summary.SkinName + ".png", UriKind.RelativeOrAbsolute); player.ChampionIcon.ChampionImage.Source = new BitmapImage(UriSource); TeamTwoPanel.Children.Add(player); } }