Call `GetContainingInputManager` at `LoadComplete`

This commit is contained in:
ekrctb 2021-07-23 10:10:55 +09:00
parent 4e9ac5dc7b
commit d49d303bae
1 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components; using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
@ -21,6 +22,8 @@ public class JuiceStreamPlacementBlueprint : CatchPlacementBlueprint<JuiceStream
private int lastEditablePathId = -1; private int lastEditablePathId = -1;
private InputManager inputManager;
public JuiceStreamPlacementBlueprint() public JuiceStreamPlacementBlueprint()
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
@ -39,6 +42,13 @@ protected override void Update()
editablePath.UpdateFrom(HitObjectContainer, HitObject); editablePath.UpdateFrom(HitObjectContainer, HitObject);
} }
protected override void LoadComplete()
{
base.LoadComplete();
inputManager = GetContainingInputManager();
}
protected override bool OnMouseDown(MouseDownEvent e) protected override bool OnMouseDown(MouseDownEvent e)
{ {
switch (PlacementActive) switch (PlacementActive)
@ -80,7 +90,7 @@ public override void UpdateTimeAndPosition(SnapResult result)
break; break;
case PlacementState.Active: case PlacementState.Active:
Vector2 unsnappedPosition = GetContainingInputManager().CurrentState.Mouse.Position; Vector2 unsnappedPosition = inputManager.CurrentState.Mouse.Position;
editablePath.MoveLastVertex(unsnappedPosition); editablePath.MoveLastVertex(unsnappedPosition);
break; break;