From 70d5c7f658f5d4d900f2cc4cb7ee1167086c8a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 15 Oct 2021 16:14:17 +0200 Subject: [PATCH] Triggering onload even if file already loaded for files loaded via http:// --- front/src/Phaser/Game/GameScene.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 7f4d97a7..f91c339b 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -290,6 +290,12 @@ export class GameScene extends DirtyScene { this.onMapLoad(data); } ); + // If the map has already been loaded as part of another GameScene, the "on load" event will not be triggered. + // In this case, we check in the cache to see if the map is here and trigger the event manually. + if (this.cache.tilemap.exists(this.MapUrlFile)) { + const data = this.cache.tilemap.get(this.MapUrlFile); + this.onMapLoad(data); + } return; } @@ -1185,7 +1191,6 @@ ${escapedMessage} iframeListener.registerAnswerer("removeActionMessage", (message) => { layoutManagerActionStore.removeAction(message.uuid); }); - } private setPropertyLayer(