This commit is contained in:
Hanusiak Piotr 2022-01-19 10:37:56 +01:00
parent e0e1a7e76a
commit 9e5d8f5d9c
6 changed files with 34 additions and 9571 deletions

View file

@ -253,10 +253,27 @@ export class UserInputManager {
this.scene.input.on(
Phaser.Input.Events.POINTER_UP,
(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => {
this.joystick.hide();
this.userInputHandler.handlePointerUpEvent(pointer, gameObjects);
}
);
this.scene.input.on(
Phaser.Input.Events.POINTER_DOWN,
(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]) => {
if (!pointer.wasTouch) {
return;
}
this.userInputHandler.handlePointerDownEvent(pointer, gameObjects);
// Let's only display the joystick if there is one finger on the screen
if ((pointer.event as TouchEvent).touches.length === 1) {
this.joystick.showAt(pointer.x, pointer.y);
} else {
this.joystick.hide();
}
}
);
this.scene.input.keyboard.on("keyup-SPACE", (event: Event) => {
this.userInputHandler.handleSpaceKeyUpEvent(event);
});