mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Handle movement locally as we are blocking events from touch->mouse mapping
This commit is contained in:
parent
b265888f18
commit
355bec2058
@ -6,6 +6,7 @@ using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.StateChanges;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
@ -27,17 +28,24 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
osuInputManager = inputManager;
|
||||
}
|
||||
|
||||
private OsuAction? lastAction;
|
||||
protected override void OnTouchMove(TouchMoveEvent e)
|
||||
{
|
||||
base.OnTouchMove(e);
|
||||
handleTouchMovement(e);
|
||||
}
|
||||
|
||||
protected override bool OnTouchDown(TouchDownEvent e)
|
||||
{
|
||||
OsuAction action = lastAction == OsuAction.LeftButton && trackedTouches.Count > 0 ? OsuAction.RightButton : OsuAction.LeftButton;
|
||||
OsuAction action = trackedTouches.Any(t => t.Action == OsuAction.LeftButton)
|
||||
? OsuAction.RightButton
|
||||
: OsuAction.LeftButton;
|
||||
|
||||
handleTouchMovement(e);
|
||||
|
||||
if (trackedTouches.All(t => t.Action != action))
|
||||
{
|
||||
trackedTouches.Add(new TrackedTouch(e.Touch, action));
|
||||
osuInputManager.KeyBindingContainer.TriggerPressed(action);
|
||||
lastAction = action;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -48,6 +56,11 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleTouchMovement(TouchEvent touchEvent)
|
||||
{
|
||||
new MousePositionAbsoluteInput { Position = touchEvent.ScreenSpaceTouch.Position }.Apply(osuInputManager.CurrentState, osuInputManager);
|
||||
}
|
||||
|
||||
protected override void OnTouchUp(TouchUpEvent e)
|
||||
{
|
||||
var tracked = trackedTouches.First(t => t.Touch.Source == e.Touch.Source);
|
||||
|
Loading…
Reference in New Issue
Block a user