1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 08:03:12 +08:00

Merge pull request #5840 from EVAST9919/fix-diff-icons

Fix filtered grouped difficulty items in DrawableCarouselBeatmapSet aren't hidden on first load

Co-authored-by: Dan Balasescu <smoogipoo@smgi.me>
This commit is contained in:
Dean Herbert 2019-08-27 12:10:47 +09:00 committed by GitHub
commit fac05bf60b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,14 +220,23 @@ namespace osu.Game.Screens.Select.Carousel
public class FilterableGroupedDifficultyIcon : GroupedDifficultyIcon
{
private readonly List<CarouselBeatmap> items;
public FilterableGroupedDifficultyIcon(List<CarouselBeatmap> items, RulesetInfo ruleset)
: base(items.Select(i => i.Beatmap).ToList(), ruleset, Color4.White)
{
items.ForEach(item => item.Filtered.ValueChanged += _ =>
{
// for now, fade the whole group based on the ratio of hidden items.
this.FadeTo(1 - 0.9f * ((float)items.Count(i => i.Filtered.Value) / items.Count), 100);
});
this.items = items;
foreach (var item in items)
item.Filtered.BindValueChanged(_ => Scheduler.AddOnce(updateFilteredDisplay));
updateFilteredDisplay();
}
private void updateFilteredDisplay()
{
// for now, fade the whole group based on the ratio of hidden items.
this.FadeTo(1 - 0.9f * ((float)items.Count(i => i.Filtered.Value) / items.Count), 100);
}
}
}