From f044b3d249fe1467d241b17ec4d358c7efb63e8d Mon Sep 17 00:00:00 2001 From: kharhamel Date: Mon, 10 May 2021 19:13:53 +0200 Subject: [PATCH] FIX: triggering a map transition now ignores other map transitions for 500ms --- front/src/Phaser/Game/GameScene.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 65129787..eb8be0e9 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -186,6 +186,7 @@ export class GameScene extends DirtyScene implements CenterListener { private popUpElements : Map = new Map(); private originalMapUrl: string|undefined; private pinchManager: PinchManager|undefined; + private mapTransitioning: boolean = false; //used to prevent transitions happenning at the same time. constructor(private room: Room, MapUrlFile: string, customKey?: string|undefined) { super({ @@ -882,6 +883,8 @@ ${escapedMessage} } private onMapExit(exitKey: string) { + if (this.mapTransitioning) return; + this.mapTransitioning = true; const {roomId, hash} = Room.getIdFromIdentifier(exitKey, this.MapUrlFile, this.instance); if (!roomId) throw new Error('Could not find the room from its exit key: '+exitKey); urlManager.pushStartLayerNameToUrl(hash); @@ -899,6 +902,7 @@ ${escapedMessage} this.initPositionFromLayerName(hash || defaultStartLayerName); this.CurrentPlayer.x = this.startX; this.CurrentPlayer.y = this.startY; + setTimeout(() => this.mapTransitioning = false, 500); } }