1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Simplify MultipleSelectionFilterTabItem state changes

This commit is contained in:
Andrei Zavatski 2020-10-28 01:41:46 +03:00
parent c4efceceb2
commit b4ec3b9fef

View File

@ -1,7 +1,6 @@
// 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.
using System;
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -43,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapListing
AddRange(CreateItems());
foreach (var item in Children)
item.StateUpdated += updateBindable;
item.Active.BindValueChanged(_ => updateBindable());
}
protected abstract MultipleSelectionFilterTabItem[] CreateItems();
@ -64,18 +63,15 @@ namespace osu.Game.Overlays.BeatmapListing
protected class MultipleSelectionFilterTabItem : FilterTabItem<T>
{
public event Action StateUpdated;
public MultipleSelectionFilterTabItem(T value)
: base(value)
{
Active.BindValueChanged(_ => StateUpdated?.Invoke());
}
protected override bool OnClick(ClickEvent e)
{
base.OnClick(e);
Active.Value = !Active.Value;
Active.Toggle();
return true;
}
}