我正在用 Flame 制作一个颤动游戏,但我在实现控制器时遇到了问题。控制器基本上是一个操纵杆和一个按钮攻击。对于操纵杆,我需要 panStart、panUpdate 和 panEnd 手势,对于攻击按钮 onTapUp 和 onTapDown。但我不能同时做两个,一次只能做一个手势
MultiTapGestureRecognizer tapper = MultiTapGestureRecognizer();
PanGestureRecognizer panGesture = PanGestureRecognizer();
panGesture.onEnd = game.onPanEnd;
panGesture.onUpdate = game.onPanUpdate;
panGesture.onStart = game.onPanStart;
panGesture.onCancel = game.onPanCancel;
tapper.onTapDown = game.onTapDown;
tapper.onTapUp = game.onTapUp;
tapper.onTapCancel = game.onTapCancel;
flameUtil.addGestureRecognizer(tapper);
flameUtil.addGestureRecognizer(panGesture);