mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 05:27:23 +08:00
Move value change bindings to LoadComplete()
Also removes a redundant one from the setter of `Current`. If the set to current comes with an associated value change, the bind-unbind flow that `BindableWithCurrent` implements will handle that change anyway.
This commit is contained in:
parent
0f82eb464f
commit
33fe843ba9
@ -26,11 +26,7 @@ namespace osu.Game.Overlays
|
|||||||
public Bindable<T> Current
|
public Bindable<T> Current
|
||||||
{
|
{
|
||||||
get => current.Current;
|
get => current.Current;
|
||||||
set
|
set => current.Current = value;
|
||||||
{
|
|
||||||
current.Current = value;
|
|
||||||
UpdateState();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 buttonColour;
|
private Color4 buttonColour;
|
||||||
@ -43,10 +39,6 @@ namespace osu.Game.Overlays
|
|||||||
Width = SettingsPanel.CONTENT_MARGINS;
|
Width = SettingsPanel.CONTENT_MARGINS;
|
||||||
Padding = new MarginPadding { Vertical = 1.5f };
|
Padding = new MarginPadding { Vertical = 1.5f };
|
||||||
Alpha = 0f;
|
Alpha = 0f;
|
||||||
|
|
||||||
Current.ValueChanged += _ => UpdateState();
|
|
||||||
Current.DisabledChanged += _ => UpdateState();
|
|
||||||
Current.DefaultChanged += _ => UpdateState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -76,6 +68,11 @@ namespace osu.Game.Overlays
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Current.ValueChanged += _ => UpdateState();
|
||||||
|
Current.DisabledChanged += _ => UpdateState();
|
||||||
|
Current.DefaultChanged += _ => UpdateState();
|
||||||
|
|
||||||
UpdateState();
|
UpdateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user