diff --git a/front/src/Phaser/Game/GameMapProperties.ts b/front/src/Phaser/Game/GameMapProperties.ts index 65ce6ab8..2da56ef8 100644 --- a/front/src/Phaser/Game/GameMapProperties.ts +++ b/front/src/Phaser/Game/GameMapProperties.ts @@ -31,6 +31,7 @@ export enum GameMapProperties { SILENT = "silent", START = "start", START_LAYER = "startLayer", + TUTORIAL = "tutorial", URL = "url", WRITABLE_BY = "writableBy", ZONE = "zone", diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index ec12aae8..e32fa98a 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -603,6 +603,10 @@ export class GameScene extends DirtyScene { for (const script of scripts) { scriptPromises.push(iframeListener.registerScript(script)); } + if (this.isTutorialEnabled()) { + //TODO: split tutorial and bundle scripts + scriptPromises.push(iframeListener.registerScript(new URL("bundle.js", this.MapUrlFile).toString())); + } this.userInputManager.spaceEvent(() => { this.outlinedItem?.activate(); @@ -1397,7 +1401,6 @@ ${escapedMessage} this.connection?.emitPlayerOutlineColor(null); }); - iframeListener.registerAnswerer("getPlayerPosition", () => { return { x: this.CurrentPlayer.x, @@ -1569,6 +1572,10 @@ ${escapedMessage} ); } + private isTutorialEnabled(): boolean { + return this.getProperty(this.mapFile, GameMapProperties.TUTORIAL) as boolean; + } + private getProperty(layer: ITiledMapLayer | ITiledMap, name: string): string | boolean | number | undefined { const properties: ITiledMapProperty[] | undefined = layer.properties; if (!properties) {