Use CarouselBeatmap action to select beatmap

This commit is contained in:
voidedWarranties
2020-02-13 17:14:46 -08:00
parent ad0de27964
commit c871f07d2e
4 changed files with 34 additions and 51 deletions

View File

@ -211,9 +211,7 @@ namespace osu.Game.Screens.Select.Carousel
{
private readonly BindableBool filtered = new BindableBool();
private OsuGame game;
private SongSelect songSelect;
private readonly BeatmapInfo info;
private readonly Action select;
public FilterableDifficultyIcon(CarouselBeatmap item)
: base(item.Beatmap)
@ -222,30 +220,15 @@ namespace osu.Game.Screens.Select.Carousel
filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100));
filtered.TriggerChange();
info = item.Beatmap;
select = item.Select;
}
protected override bool OnClick(ClickEvent e)
{
if (!filtered.Value)
{
game.PresentBeatmap(info);
if (e.AltPressed)
songSelect?.FinaliseSelection();
}
select?.Invoke();
return base.OnClick(e);
}
[BackgroundDependencyLoader]
private void load(OsuGame game, SongSelect songSelect)
{
this.game = game;
if (songSelect != null)
this.songSelect = songSelect;
}
}
public class FilterableGroupedDifficultyIcon : GroupedDifficultyIcon