From f661806513767adaf69f5989bcf4b3b90397f994 Mon Sep 17 00:00:00 2001 From: TheWildTree Date: Sat, 29 Feb 2020 15:29:00 +0100 Subject: [PATCH] Move checking logic out of ScoreTable --- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 9 ++++----- osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 25537537d9..3a58f481e1 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -29,7 +29,6 @@ public class ScoreTable : TableContainer private readonly FillFlowContainer backgroundFlow; private Color4 highAccuracyColour; - private bool isBeatmapRanked; public ScoreTable() { @@ -67,13 +66,13 @@ public IReadOnlyList Scores for (int i = 0; i < value.Count; i++) backgroundFlow.Add(new ScoreTableRowBackground(i, value[i], row_height)); - isBeatmapRanked = value.First().Beatmap.Status == BeatmapSetOnlineStatus.Ranked; - Columns = createHeaders(value.First()); Content = value.Select((s, i) => createContent(i, s)).ToArray().ToRectangular(); } } + public bool IsBeatmapRanked { get; set; } + private TableColumn[] createHeaders(ScoreInfo score) { var columns = new List @@ -92,7 +91,7 @@ private TableColumn[] createHeaders(ScoreInfo score) columns.Add(new TableColumn(score.SortedStatistics.LastOrDefault().Key.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 45, maxSize: 95))); - if (isBeatmapRanked) + if (IsBeatmapRanked) columns.Add(new TableColumn("pp", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, 30))); columns.Add(new TableColumn("mods", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize))); @@ -153,7 +152,7 @@ private Drawable[] createContent(int index, ScoreInfo score) }); } - if (isBeatmapRanked) + if (IsBeatmapRanked) { content.Add(new OsuSpriteText { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index e831c8ce42..5a931fffcb 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -59,11 +59,12 @@ protected APILegacyScores Scores } var scoreInfos = value.Scores.Select(s => s.CreateScoreInfo(rulesets)).ToList(); + var topScore = scoreInfos.First(); scoreTable.Scores = scoreInfos; + scoreTable.IsBeatmapRanked = topScore.Beatmap.Status == BeatmapSetOnlineStatus.Ranked; scoreTable.Show(); - var topScore = scoreInfos.First(); var userScore = value.UserScore; var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets);