public RankedSinglePlayer(PanelPlayer player, Values.StatType type) { InitializeComponent(); this.player = player; this.type = type; this.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; if (this.player != null) { if (type == Values.StatType.RankedTPP) { this.stats = this.player.RankedStatsObj.data.attributes.rankedGameModeStats.squad; } else if (type == Values.StatType.RankedFPP) { this.stats = this.player.RankedStatsObj.data.attributes.rankedGameModeStats.squadFpp; } this.UpdateStatLabels(); this.GenerateRecentM20MapsChart(); SinglePlayerMatchFiltering matchFiltering = new SinglePlayerMatchFiltering(this.player.Matches, this.type, "competitive", this.player.Name); this.BuildChart(matchFiltering.GetList()); } fraggerRatingGauge.From = 0; fraggerRatingGauge.To = 100; fraggerRatingGauge.Base.LabelsVisibility = Visibility.Hidden; fraggerRatingGauge.Base.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(242, 169, 0)); fraggerRatingGauge.Base.GaugeActiveFill = new LinearGradientBrush { GradientStops = new GradientStopCollection { new GradientStop(Colors.Yellow, 0), new GradientStop(Colors.Orange, .5), new GradientStop(Colors.Red, 1) } }; int x = (panel3.Size.Width - this.labelRankTitle.Size.Width) / 2; this.labelRankTitle.Location = new System.Drawing.Point(x, this.labelRankTitle.Location.Y); }
private static async Task <RankedObject> ComputeStatsRanked(ModeStatsRanked stats, List <RootMatch> matches, string playername) { if (stats != null) { RankedObject ranked = GetRankedObject((int)stats.currentRankPoint); ranked.GamesPlayed = (int)stats.RoundsPlayed; ranked.Wins = (int)stats.Wins; ranked.WinPercent = Math.Round(StatsCalculation.GetWinRatio(stats.Wins, stats.RoundsPlayed), 2); ranked.AverageRank = Math.Round(stats.AvgRank, 2); ranked.TopTenPercent = Math.Round(stats.Top10Ratio * 100, 2); ranked.Adr = (int)Math.Round(StatsCalculation.GetAdr(stats.DamageDealt, stats.RoundsPlayed), 0); ranked.Kd = Math.Round(StatsCalculation.GetKD(stats.Kills, stats.Deaths), 2); ranked.Kda = Math.Round(StatsCalculation.GetKDA(stats.Kills, stats.Assists, stats.Deaths), 2); ranked.DbnosPerRound = Math.Round(StatsCalculation.GetKnocksPerRound(stats.Dbnos, stats.RoundsPlayed), 2); ranked.FraggerRating = await Task.Run(() => ComputeRankedFraggerRating(matches, playername)); return(ranked); } else { RankedObject ranked = GetRankedObject(0); ranked.GamesPlayed = 0; ranked.Wins = 0; ranked.WinPercent = 0; ranked.AverageRank = 0; ranked.TopTenPercent = 0; ranked.Adr = 0; ranked.Kd = 0; ranked.Kda = 0; ranked.DbnosPerRound = 0; ranked.FraggerRating = 0; return(ranked); } }