mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Split out simple DifficultyIcon
with no calculation overhead and update usages
This commit is contained in:
@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
Origin = Anchor.CentreLeft,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DifficultyIcon(beatmapInfo, shouldShowTooltip: false)
|
||||
new CalculatingDifficultyIcon(beatmapInfo, shouldShowTooltip: false)
|
||||
{
|
||||
Scale = new Vector2(1.8f),
|
||||
},
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Beatmaps.Drawables;
|
||||
|
||||
namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
public class FilterableDifficultyIcon : DifficultyIcon
|
||||
public class FilterableDifficultyIcon : CalculatingDifficultyIcon
|
||||
{
|
||||
private readonly BindableBool filtered = new BindableBool();
|
||||
|
||||
@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
public readonly CarouselBeatmap Item;
|
||||
|
||||
public FilterableDifficultyIcon(CarouselBeatmap item)
|
||||
: base(item.BeatmapInfo, performBackgroundDifficultyLookup: false)
|
||||
: base(item.BeatmapInfo)
|
||||
{
|
||||
filtered.BindTo(item.Filtered);
|
||||
filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100));
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user