1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:07:44 +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:
Bartłomiej Dach 2021-05-17 20:44:47 +02:00
parent 0f82eb464f
commit 33fe843ba9

View File

@ -26,11 +26,7 @@ namespace osu.Game.Overlays
public Bindable<T> Current
{
get => current.Current;
set
{
current.Current = value;
UpdateState();
}
set => current.Current = value;
}
private Color4 buttonColour;
@ -43,10 +39,6 @@ namespace osu.Game.Overlays
Width = SettingsPanel.CONTENT_MARGINS;
Padding = new MarginPadding { Vertical = 1.5f };
Alpha = 0f;
Current.ValueChanged += _ => UpdateState();
Current.DisabledChanged += _ => UpdateState();
Current.DefaultChanged += _ => UpdateState();
}
[BackgroundDependencyLoader]
@ -76,6 +68,11 @@ namespace osu.Game.Overlays
protected override void LoadComplete()
{
base.LoadComplete();
Current.ValueChanged += _ => UpdateState();
Current.DisabledChanged += _ => UpdateState();
Current.DefaultChanged += _ => UpdateState();
UpdateState();
}
@ -113,4 +110,4 @@ namespace osu.Game.Overlays
this.FadeColour(current.Disabled ? Color4.Gray : buttonColour, 200, Easing.OutQuint);
}
}
}
}