Split out simple DifficultyIcon with no calculation overhead and update usages

This commit is contained in:
Dean Herbert
2022-06-23 18:37:53 +09:00
parent 4a2ca4394b
commit 7dec530ca5
8 changed files with 120 additions and 70 deletions

View File

@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select.Carousel
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
Status = beatmapSet.Status
},
new FillFlowContainer<DifficultyIcon>
new FillFlowContainer<CalculatingDifficultyIcon>
{
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(3),
@ -87,13 +87,13 @@ namespace osu.Game.Screens.Select.Carousel
private const int maximum_difficulty_icons = 18;
private IEnumerable<DifficultyIcon> getDifficultyIcons()
private IEnumerable<CalculatingDifficultyIcon> getDifficultyIcons()
{
var beatmaps = carouselSet.Beatmaps.ToList();
return beatmaps.Count > maximum_difficulty_icons
? (IEnumerable<DifficultyIcon>)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset)
.Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset))
? (IEnumerable<CalculatingDifficultyIcon>)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset)
.Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset))
: beatmaps.Select(b => new FilterableDifficultyIcon(b));
}
}