/// <summary> /// Creates all of the statistics items. /// </summary> private void CreateStatisticsKeyValueItems() { var meanItem = new ResultKeyValueItem(ResultKeyValueItemType.Vertical, "AVERAGE", $"{-HitStatistics.Mean:F} ms") { Parent = this, Y = TopHorizontalDividerLine.Y + 15 }; var standardDeviationItem = new ResultKeyValueItem(ResultKeyValueItemType.Vertical, "STANDARD DEVIATION", $"{HitStatistics.StandardDeviation:F} ms") { Parent = this, Y = TopHorizontalDividerLine.Y + 15 }; var availableWidth = Width - VerticalDividerLine.X; var padding = (availableWidth - meanItem.Width - standardDeviationItem.Width) / 3; meanItem.X = VerticalDividerLine.X + padding; standardDeviationItem.X = Width - padding - standardDeviationItem.Width; }
/// <summary> /// Creates all of the main ite /// </summary> private void CreateKeyValueItems() { double performanceRating; switch (Screen.ResultsType) { case ResultScreenType.Gameplay: if (Screen.ScoreProcessor.Failed) { performanceRating = 0; } else { performanceRating = new RatingProcessorKeys(MapManager.Selected.Value.DifficultyFromMods(Screen.ScoreProcessor.Mods)).CalculateRating(Screen.Gameplay.Ruleset.StandardizedReplayPlayer.ScoreProcessor); } break; case ResultScreenType.Replay: if (Screen.ScoreProcessor.Failed) { performanceRating = 0; } else { performanceRating = new RatingProcessorKeys(MapManager.Selected.Value.DifficultyFromMods(Screen.ScoreProcessor.Mods)).CalculateRating(Screen.ScoreProcessor); } break; case ResultScreenType.Score: performanceRating = Screen.Score.PerformanceRating; break; default: throw new ArgumentOutOfRangeException(); } ResultKeyValueItem standardized = null; int spacing; const int beginPosition = 40; if (StandardizedProcessor != null || Screen.ResultsType == ResultScreenType.Score && !Screen.Score.IsOnline) { var acc = StandardizedProcessor?.Accuracy ?? Screen.Score.RankedAccuracy; standardized = new ResultKeyValueItem(ResultKeyValueItemType.Vertical, "RANKED ACCURACY", StringHelper.AccuracyToString((float)acc)); spacing = 44; } else { spacing = 100; } ResultKeyValueItems = new List <ResultKeyValueItem>() { new ResultKeyValueItem(ResultKeyValueItemType.Vertical, "SCORE RATING", $"{performanceRating:F}"), new ResultKeyValueItem(ResultKeyValueItemType.Vertical, "TOTAL SCORE", $"{Screen.ScoreProcessor.Score:N0}"), new ResultKeyValueItem(ResultKeyValueItemType.Vertical, "ACCURACY", StringHelper.AccuracyToString(Screen.ScoreProcessor.Accuracy)), }; if (standardized != null) { ResultKeyValueItems.Add(standardized); } ResultKeyValueItems.Add(new ResultKeyValueItem(ResultKeyValueItemType.Vertical, "MAX COMBO", $"{Screen.ScoreProcessor.MaxCombo}x")); for (var i = 0; i < ResultKeyValueItems.Count; i++) { var item = ResultKeyValueItems[i]; item.Parent = this; item.Y = TopHorizontalDividerLine.Y + 15; if (i == 0) { item.X = beginPosition; continue; } item.X = ResultKeyValueItems[i - 1].X + ResultKeyValueItems[i - 1].Width + spacing; } // Add a divider line at the bottom of the key value items var firstItem = ResultKeyValueItems.First(); ResultKeyValueItemDividerLine = new Sprite { Parent = this, Y = firstItem.Y + firstItem.TextValue.Y + firstItem.TextValue.Height + 15, Size = new ScalableVector2(Width, 1), Alpha = 0.45f }; }