mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Consume display name logic
This commit is contained in:
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
/// <summary>
|
||||
/// The statistics that appear in the table, in order of appearance.
|
||||
/// </summary>
|
||||
private readonly List<HitResult> statisticResultTypes = new List<HitResult>();
|
||||
private readonly List<(HitResult result, string displayName)> statisticResultTypes = new List<(HitResult, string)>();
|
||||
|
||||
private bool showPerformancePoints;
|
||||
|
||||
@ -101,15 +101,19 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
};
|
||||
|
||||
// All statistics across all scores, unordered.
|
||||
var allScoreStatistics = scores.SelectMany(s => s.GetStatisticsForDisplay().Select(stat => stat.result)).ToHashSet();
|
||||
var allScoreStatistics = scores.SelectMany(s => s.GetStatisticsForDisplay().Select(stat => stat.Result)).ToHashSet();
|
||||
|
||||
var ruleset = scores.First().Ruleset.CreateInstance();
|
||||
|
||||
foreach (var result in OrderAttributeUtils.GetValuesInOrder<HitResult>())
|
||||
{
|
||||
if (!allScoreStatistics.Contains(result))
|
||||
continue;
|
||||
|
||||
columns.Add(new TableColumn(result.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 35, maxSize: 60)));
|
||||
statisticResultTypes.Add(result);
|
||||
string displayName = ruleset.GetDisplayNameForHitResult(result);
|
||||
|
||||
columns.Add(new TableColumn(displayName, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 35, maxSize: 60)));
|
||||
statisticResultTypes.Add((result, displayName));
|
||||
}
|
||||
|
||||
if (showPerformancePoints)
|
||||
@ -163,18 +167,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
}
|
||||
};
|
||||
|
||||
var availableStatistics = score.GetStatisticsForDisplay().ToDictionary(tuple => tuple.result);
|
||||
var availableStatistics = score.GetStatisticsForDisplay().ToDictionary(tuple => tuple.Result);
|
||||
|
||||
foreach (var result in statisticResultTypes)
|
||||
{
|
||||
if (!availableStatistics.TryGetValue(result, out var stat))
|
||||
stat = (result, 0, null);
|
||||
if (!availableStatistics.TryGetValue(result.result, out var stat))
|
||||
stat = new HitResultDisplayStatistic(result.result, 0, null, result.displayName);
|
||||
|
||||
content.Add(new OsuSpriteText
|
||||
{
|
||||
Text = stat.maxCount == null ? $"{stat.count}" : $"{stat.count}/{stat.maxCount}",
|
||||
Text = stat.MaxCount == null ? $"{stat.Count}" : $"{stat.Count}/{stat.MaxCount}",
|
||||
Font = OsuFont.GetFont(size: text_size),
|
||||
Colour = stat.count == 0 ? Color4.Gray : Color4.White
|
||||
Colour = stat.Count == 0 ? Color4.Gray : Color4.White
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user