1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:52:55 +08:00

Change spinner to check currently pressed actions rather than implementing IKeyBindingHandler

This commit is contained in:
Shane Woolcock 2017-08-18 16:46:00 +09:30
parent 9c6ca2d159
commit 9628c0b6d6
2 changed files with 9 additions and 33 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
@ -165,6 +166,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
glow.Colour = colours.BlueDark;
}
protected override void Update()
{
disc.Tracking = OsuActionInputManager.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton);
base.Update();
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();

View File

@ -12,7 +12,7 @@ using OpenTK.Graphics;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public class SpinnerDisc : CircularContainer, IHasAccentColour, IKeyBindingHandler<OsuAction>
public class SpinnerDisc : CircularContainer, IHasAccentColour
{
private readonly Spinner spinner;
@ -73,39 +73,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
return base.OnMouseMove(state);
}
public bool OnPressed(OsuAction action)
{
switch (action)
{
case OsuAction.LeftButton:
actionLeftButtonPressed = true;
break;
case OsuAction.RightButton:
actionRightButtonPressed = true;
break;
}
Tracking = actionLeftButtonPressed || actionRightButtonPressed;
return false;
}
public bool OnReleased(OsuAction action)
{
switch (action)
{
case OsuAction.LeftButton:
actionLeftButtonPressed = false;
break;
case OsuAction.RightButton:
actionRightButtonPressed = false;
break;
}
Tracking = actionLeftButtonPressed || actionRightButtonPressed;
return false;
}
private Vector2 mousePosition;
private bool actionLeftButtonPressed;
private bool actionRightButtonPressed;
private float lastAngle;
private float currentRotation;