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

Use CarouselBeatmap.State to select

This commit is contained in:
voidedWarranties 2020-02-13 17:47:16 -08:00
parent c871f07d2e
commit 368e6f9579
4 changed files with 5 additions and 12 deletions

View File

@ -446,7 +446,7 @@ namespace osu.Game
/// </summary>
/// <param name="action">The action to perform once we are in the correct state.</param>
/// <param name="validScreens">An optional collection of valid screen types. If any of these screens are already current we can perform the action immediately, else the first valid parent will be made current before performing the action. <see cref="MainMenu"/> is used if not specified.</param>
public void PerformFromScreen(Action<IScreen> action, IEnumerable<Type> validScreens = null)
protected void PerformFromScreen(Action<IScreen> action, IEnumerable<Type> validScreens = null)
{
performFromMainMenuTask?.Cancel();

View File

@ -592,8 +592,6 @@ namespace osu.Game.Screens.Select
scrollPositionCache.Invalidate();
}
};
c.Select = () => SelectBeatmap(c.Beatmap);
}
return set;

View File

@ -13,11 +13,6 @@ namespace osu.Game.Screens.Select.Carousel
{
public readonly BeatmapInfo Beatmap;
/// <summary>
/// Select this beatmap on the carousel.
/// </summary>
public Action Select;
public CarouselBeatmap(BeatmapInfo beatmap)
{
Beatmap = beatmap;

View File

@ -211,7 +211,7 @@ namespace osu.Game.Screens.Select.Carousel
{
private readonly BindableBool filtered = new BindableBool();
private readonly Action select;
private readonly CarouselBeatmap item;
public FilterableDifficultyIcon(CarouselBeatmap item)
: base(item.Beatmap)
@ -220,14 +220,14 @@ namespace osu.Game.Screens.Select.Carousel
filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100));
filtered.TriggerChange();
select = item.Select;
this.item = item;
}
protected override bool OnClick(ClickEvent e)
{
select?.Invoke();
item.State.Value = CarouselItemState.Selected;
return base.OnClick(e);
return true;
}
}