Use BindValueChanged

This commit is contained in:
Dean Herbert 2019-10-14 17:13:36 +09:00
parent 64a6ca28e6
commit ae2fe62fd9
1 changed files with 6 additions and 11 deletions

View File

@ -9,7 +9,6 @@
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -20,7 +19,7 @@ public class OsuResumeOverlay : ResumeOverlay
{ {
private OsuClickToResumeCursor clickToResumeCursor; private OsuClickToResumeCursor clickToResumeCursor;
private GameplayCursorContainer localCursorContainer; private OsuCursorContainer localCursorContainer;
public override CursorContainer LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null; public override CursorContainer LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null;
@ -39,17 +38,13 @@ public override void Show()
if (localCursorContainer == null) if (localCursorContainer == null)
{ {
var newContainer = new OsuCursorContainer(); Add(localCursorContainer = new OsuCursorContainer());
Add(localCursorContainer = newContainer);
clickToResumeCursor.CursorScale = newContainer.CalculatedCursorScale.Value; localCursorContainer.CalculatedCursorScale.BindValueChanged(scale =>
clickToResumeCursor.Scale = new Vector2(newContainer.CalculatedCursorScale.Value);
newContainer.CalculatedCursorScale.ValueChanged += e =>
{ {
clickToResumeCursor.CursorScale = e.NewValue; clickToResumeCursor.CursorScale = scale.NewValue;
clickToResumeCursor.Scale = new Vector2(e.NewValue); clickToResumeCursor.Scale = new Vector2(scale.NewValue);
}; }, true);
} }
} }