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

Fix bindable being created far too late in construction

This commit is contained in:
Dean Herbert 2020-02-14 15:59:59 +09:00
parent 884a5fbad4
commit 9cbb37b682

View File

@ -30,7 +30,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private readonly Drawable cursorTrail; private readonly Drawable cursorTrail;
public Bindable<float> CursorScale; public Bindable<float> CursorScale = new BindableFloat(1);
private Bindable<float> userCursorScale; private Bindable<float> userCursorScale;
private Bindable<bool> autoCursorScale; private Bindable<bool> autoCursorScale;
@ -57,6 +58,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete();
showTrail.BindValueChanged(v => cursorTrail.FadeTo(v.NewValue ? 1 : 0, 200), true); showTrail.BindValueChanged(v => cursorTrail.FadeTo(v.NewValue ? 1 : 0, 200), true);
userCursorScale = config.GetBindable<float>(OsuSetting.GameplayCursorSize); userCursorScale = config.GetBindable<float>(OsuSetting.GameplayCursorSize);
@ -65,7 +68,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize); autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
autoCursorScale.ValueChanged += _ => calculateScale(); autoCursorScale.ValueChanged += _ => calculateScale();
CursorScale = new BindableFloat();
CursorScale.ValueChanged += e => CursorScale.ValueChanged += e =>
{ {
var newScale = new Vector2(e.NewValue); var newScale = new Vector2(e.NewValue);
@ -75,8 +77,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
}; };
calculateScale(); calculateScale();
base.LoadComplete();
} }
/// <summary> /// <summary>