Tidy up code quality

This commit is contained in:
Dean Herbert 2022-09-08 19:44:29 +09:00
parent 4f22616860
commit b9afe6f4cf

View File

@ -18,28 +18,17 @@ namespace osu.Game.Rulesets.Catch.UI
{ {
public class CatchTouchInputMapper : VisibilityContainer public class CatchTouchInputMapper : VisibilityContainer
{ {
public enum TouchCatchAction
{
MoveLeft = 0,
MoveRight = 1,
DashLeft = 2,
DashRight = 3,
None = 4
}
private Dictionary<object, TouchCatchAction> trackedActions = new Dictionary<object, TouchCatchAction>(); private Dictionary<object, TouchCatchAction> trackedActions = new Dictionary<object, TouchCatchAction>();
private KeyBindingContainer<CatchAction> keyBindingContainer = null!; private KeyBindingContainer<CatchAction> keyBindingContainer = null!;
private Container mainContent = null!; private Container mainContent = null!;
// Fill values with null because UI is not declared in constructor
private ArrowHitbox leftBox = null!; private ArrowHitbox leftBox = null!;
private ArrowHitbox rightBox = null!; private ArrowHitbox rightBox = null!;
private ArrowHitbox leftDashBox = null!; private ArrowHitbox leftDashBox = null!;
private ArrowHitbox rightDashBox = null!; private ArrowHitbox rightDashBox = null!;
// Force input to be prossed even when hidden.
public override bool PropagatePositionalInputSubTree => true; public override bool PropagatePositionalInputSubTree => true;
public override bool PropagateNonPositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true;
@ -151,11 +140,6 @@ namespace osu.Game.Rulesets.Catch.UI
return true; return true;
} }
protected override void OnDragEnd(DragEndEvent e)
{
base.OnDragEnd(e);
}
protected override void OnDrag(DragEvent e) protected override void OnDrag(DragEvent e)
{ {
// I'm not sure if this is posible but let's be safe // I'm not sure if this is posible but let's be safe
@ -167,6 +151,7 @@ namespace osu.Game.Rulesets.Catch.UI
base.OnDrag(e); base.OnDrag(e);
} }
protected override void OnTouchMove(TouchMoveEvent e) protected override void OnTouchMove(TouchMoveEvent e)
{ {
// I'm not sure if this is posible but let's be safe // I'm not sure if this is posible but let's be safe
@ -240,6 +225,7 @@ namespace osu.Game.Rulesets.Catch.UI
return TouchCatchAction.MoveLeft; return TouchCatchAction.MoveLeft;
if (rightBox.Contains(inputPosition)) if (rightBox.Contains(inputPosition))
return TouchCatchAction.MoveRight; return TouchCatchAction.MoveRight;
return TouchCatchAction.None; return TouchCatchAction.None;
} }
@ -316,5 +302,14 @@ namespace osu.Game.Rulesets.Catch.UI
} }
} }
} }
public enum TouchCatchAction
{
MoveLeft = 0,
MoveRight = 1,
DashLeft = 2,
DashRight = 3,
None = 4
}
} }
} }