Update song select statistics when mod changes settings

This commit is contained in:
Dean Herbert
2019-12-20 18:00:04 +09:00
parent ce41be59aa
commit 822903d5db
3 changed files with 57 additions and 8 deletions

View File

@ -1,6 +1,7 @@
// 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.Allocation;
using osu.Framework.Bindables;
@ -20,7 +21,7 @@ using osuTK;
namespace osu.Game.Overlays.Settings
{
public abstract class SettingsItem<T> : Container, IFilterable
public abstract class SettingsItem<T> : Container, IFilterable, ISettingsItem
{
protected abstract Drawable CreateControl();
@ -34,8 +35,6 @@ namespace osu.Game.Overlays.Settings
private SpriteText text;
private readonly RestoreDefaultValueButton restoreDefaultButton;
public bool ShowsDefaultIndicator = true;
public virtual string LabelText
@ -70,8 +69,12 @@ namespace osu.Game.Overlays.Settings
public bool FilteringActive { get; set; }
public event Action SettingChanged;
protected SettingsItem()
{
RestoreDefaultValueButton restoreDefaultButton;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = SettingsPanel.CONTENT_MARGINS };
@ -87,13 +90,12 @@ namespace osu.Game.Overlays.Settings
Child = Control = CreateControl()
},
};
}
[BackgroundDependencyLoader]
private void load()
{
// all bindable logic is in constructor intentionally to support "CreateSettingsControls" being used in a context it is
// never loaded, but requires bindable storage.
if (controlWithCurrent != null)
{
controlWithCurrent.Current.ValueChanged += _ => SettingChanged?.Invoke();
controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; };
if (ShowsDefaultIndicator)