mirror of
https://github.com/ppy/osu.git
synced 2025-01-31 19:05:36 +08:00
Simplify MultipleSelectionFilterTabItem state changes
This commit is contained in:
parent
c4efceceb2
commit
b4ec3b9fef
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -43,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
AddRange(CreateItems());
|
AddRange(CreateItems());
|
||||||
|
|
||||||
foreach (var item in Children)
|
foreach (var item in Children)
|
||||||
item.StateUpdated += updateBindable;
|
item.Active.BindValueChanged(_ => updateBindable());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract MultipleSelectionFilterTabItem[] CreateItems();
|
protected abstract MultipleSelectionFilterTabItem[] CreateItems();
|
||||||
@ -64,18 +63,15 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
protected class MultipleSelectionFilterTabItem : FilterTabItem<T>
|
protected class MultipleSelectionFilterTabItem : FilterTabItem<T>
|
||||||
{
|
{
|
||||||
public event Action StateUpdated;
|
|
||||||
|
|
||||||
public MultipleSelectionFilterTabItem(T value)
|
public MultipleSelectionFilterTabItem(T value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
Active.BindValueChanged(_ => StateUpdated?.Invoke());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
base.OnClick(e);
|
base.OnClick(e);
|
||||||
Active.Value = !Active.Value;
|
Active.Toggle();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user