From af260ad22917b30a819f1a0d2ef788b546d82364 Mon Sep 17 00:00:00 2001 From: Piotr Dobrowolski Date: Sun, 3 Jan 2021 12:23:13 +0100 Subject: [PATCH] front: add AnimatedTiles plugin --- front/package.json | 1 + front/src/Phaser/Game/GameScene.ts | 5 +++++ front/tsconfig.json | 1 + front/yarn.lock | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/front/package.json b/front/package.json index 09f27ec5..d429bd42 100644 --- a/front/package.json +++ b/front/package.json @@ -27,6 +27,7 @@ "generic-type-guard": "^3.2.0", "google-protobuf": "^3.13.0", "phaser": "^3.22.0", + "phaser-animated-tiles": "Informatic/phaser-animated-tiles#2d5c66a9bc426dd4cb2d856c1d599494a74f8067", "queue-typescript": "^1.0.1", "quill": "^1.3.7", "simple-peer": "^9.6.2", diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 181592e2..ab9232d4 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -68,6 +68,8 @@ import {SelectCharacterScene, SelectCharacterSceneName} from "../Login/SelectCha import {TextureError} from "../../Exception/TextureError"; import {TextField} from "../Components/TextField"; +import AnimatedTiles from "phaser-animated-tiles"; + export interface GameSceneInitInterface { initPosition: PointInterface|null, reconnecting: boolean @@ -114,6 +116,7 @@ export class GameScene extends ResizableScene implements CenterListener { Layers!: Array; Objects!: Array; mapFile!: ITiledMap; + animatedTiles!: AnimatedTiles; groups: Map; startX!: number; startY!: number; @@ -189,6 +192,7 @@ export class GameScene extends ResizableScene implements CenterListener { file: file.src }); }); + this.load.scenePlugin('AnimatedTiles', AnimatedTiles, 'animatedTiles', 'animatedTiles'); this.load.on('filecomplete-tilemapJSON-'+this.MapUrlFile, (key: string, type: string, data: unknown) => { this.onMapLoad(data); }); @@ -400,6 +404,7 @@ export class GameScene extends ResizableScene implements CenterListener { this.initCamera(); + this.animatedTiles.init(this.Map); this.initCirclesCanvas(); // Let's pause the scene if the connection is not established yet diff --git a/front/tsconfig.json b/front/tsconfig.json index 3fce57ea..fbfc8c07 100644 --- a/front/tsconfig.json +++ b/front/tsconfig.json @@ -8,6 +8,7 @@ "downlevelIteration": true, "jsx": "react", "allowJs": true, + "esModuleInterop": true, "strict": true, /* Enable all strict type-checking options. */ "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ diff --git a/front/yarn.lock b/front/yarn.lock index a31409a6..ea50cc4d 100644 --- a/front/yarn.lock +++ b/front/yarn.lock @@ -3663,6 +3663,10 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" +phaser-animated-tiles@Informatic/phaser-animated-tiles#2d5c66a9bc426dd4cb2d856c1d599494a74f8067: + version "2.0.2" + resolved "https://codeload.github.com/Informatic/phaser-animated-tiles/tar.gz/2d5c66a9bc426dd4cb2d856c1d599494a74f8067" + phaser@^3.22.0: version "3.51.0" resolved "https://registry.yarnpkg.com/phaser/-/phaser-3.51.0.tgz#b0c7ee2b21e795830d74f476dd30816a42b023bd"