mirror of
https://github.com/ppy/osu
synced 2025-03-25 04:18:03 +00:00
Simplify icon creation
This commit is contained in:
parent
ef397434f6
commit
9881d3677d
@ -100,7 +100,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Spacing = new Vector2(3),
|
Spacing = new Vector2(3),
|
||||||
Children = getDifficultyIcons(),
|
ChildrenEnumerable = getDifficultyIcons(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,19 +111,13 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
|
|
||||||
private const int maximum_difficulty_icons = 18;
|
private const int maximum_difficulty_icons = 18;
|
||||||
|
|
||||||
private List<DifficultyIcon> getDifficultyIcons()
|
private IEnumerable<DifficultyIcon> getDifficultyIcons()
|
||||||
{
|
{
|
||||||
var beatmaps = ((CarouselBeatmapSet)Item).Beatmaps.ToList();
|
var beatmaps = ((CarouselBeatmapSet)Item).Beatmaps.ToList();
|
||||||
var icons = new List<DifficultyIcon>();
|
|
||||||
|
|
||||||
if (beatmaps.Count > maximum_difficulty_icons)
|
return beatmaps.Count > maximum_difficulty_icons
|
||||||
{
|
? (IEnumerable<DifficultyIcon>)beatmaps.GroupBy(b => b.Beatmap.Ruleset).Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Key))
|
||||||
foreach (var group in beatmaps.GroupBy(b => b.Beatmap.Ruleset))
|
: beatmaps.Select(b => new FilterableDifficultyIcon(b));
|
||||||
icons.Add(new FilterableGroupedDifficultyIcon(group.ToList(), group.Key));
|
|
||||||
}
|
|
||||||
else beatmaps.ForEach(b => icons.Add(new FilterableDifficultyIcon(b)));
|
|
||||||
|
|
||||||
return icons;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuItem[] ContextMenuItems
|
public MenuItem[] ContextMenuItems
|
||||||
|
Loading…
Reference in New Issue
Block a user