diff --git a/src/ui/battle/Arena.ts b/src/ui/battle/Arena.ts index 5773158..eb1296a 100644 --- a/src/ui/battle/Arena.ts +++ b/src/ui/battle/Arena.ts @@ -99,8 +99,10 @@ module TK.SpaceTac.UI { // Capture clicks on background background.setInteractive(); - background.on("pointerup", () => { - this.callbacks_click.forEach(callback => callback()); + background.on("pointerup", (pointer: Phaser.Input.Pointer) => { + if (pointer.buttons == 1) { + this.callbacks_click.forEach(callback => callback()); + } }); background.on("pointerout", () => { this.callbacks_hover.forEach(callback => callback(null, null)); @@ -250,7 +252,7 @@ module TK.SpaceTac.UI { let sprite = this.findDrone(drone); if (sprite) { remove(this.drone_sprites, sprite); - return sprite.setDestroyed(); + return sprite.setDestroyed(speed); } else { console.error("Drone not found in arena for removal", drone); } diff --git a/src/ui/battle/ArenaDrone.ts b/src/ui/battle/ArenaDrone.ts index afadd13..92c9bef 100644 --- a/src/ui/battle/ArenaDrone.ts +++ b/src/ui/battle/ArenaDrone.ts @@ -59,9 +59,11 @@ module TK.SpaceTac.UI { * * Return the animation duration */ - async setDestroyed(): Promise { - this.view.animations.addAnimation(this, { alpha: 0.3 }, 300, undefined, 200); - await this.view.animations.addAnimation(this.radius, { scaleX: 0, scaleY: 0 }, 500); + async setDestroyed(speed = 1): Promise { + if (speed) { + this.view.animations.addAnimation(this, { alpha: 0.3 }, 300 / speed, undefined, 200 / speed); + await this.view.animations.addAnimation(this.radius, { scaleX: 0, scaleY: 0 }, 500 / speed); + } this.destroy(); } diff --git a/src/ui/common/InputManager.ts b/src/ui/common/InputManager.ts index 1358318..565866e 100644 --- a/src/ui/common/InputManager.ts +++ b/src/ui/common/InputManager.ts @@ -210,7 +210,7 @@ module TK.SpaceTac.UI { enternext = Timer.global.schedule(hovertime, effectiveenter); }); - obj.on("pointerout", (pointer: Phaser.Input.Pointer) => { + obj.on("pointerout", () => { if (destroyed) return; if (this.hovered === obj) { @@ -222,7 +222,7 @@ module TK.SpaceTac.UI { }); obj.on("pointerdown", (pointer: Phaser.Input.Pointer) => { - if (destroyed) return; + if (destroyed || pointer.buttons != 1) return; if (UITools.isVisible(obj)) { holdstart = Timer.nowMs(); @@ -235,8 +235,8 @@ module TK.SpaceTac.UI { } }); - obj.on("pointerup", (event: Phaser.Input.Pointer) => { - if (destroyed) return; + obj.on("pointerup", (pointer: Phaser.Input.Pointer) => { + if (destroyed || pointer.buttons != 1) return; if (!cursorinside) { effectiveleave();