From: David NĂ©grier Date: Wed, 15 Apr 2020 21:57:36 +0000 (+0200) Subject: Backporting master changes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9175682f323160c0ec0f6c7edb1cfa80bd4a9d12;p=libreadventure.git Backporting master changes --- 9175682f323160c0ec0f6c7edb1cfa80bd4a9d12 diff --cc front/src/Phaser/Game/GameScene.ts index 6bd2619,36054b4..a08c8fd --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@@ -3,7 -3,7 +3,8 @@@ import {MessageUserPositionInterface} f import {CurrentGamerInterface, GamerInterface, Player} from "../Player/Player"; import {DEBUG_MODE, RESOLUTION, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable"; import Tile = Phaser.Tilemaps.Tile; + import {ITiledMap, ITiledTileSet} from "../Map/ITiledMap"; +import {cypressAsserter} from "../../Cypress/CypressAsserter"; export enum Textures { Rock = 'rock', @@@ -40,9 -42,17 +43,18 @@@ export class GameScene extends Phaser.S //hook preload scene preload(): void { + cypressAsserter.preloadStarted(); - this.load.image(Textures.Tiles, 'maps/tiles.png'); - this.load.tilemapTiledJSON(Textures.Map, 'maps/map2.json'); + let mapUrl = 'maps/map2.json'; + this.load.on('filecomplete-tilemapJSON-'+Textures.Map, (key: string, type: string, data: any) => { + // Triggered when the map is loaded + // Load tiles attached to the map recursively + this.map = data.data; + this.map.tilesets.forEach((tileset) => { + let path = mapUrl.substr(0, mapUrl.lastIndexOf('/')); + this.load.image(tileset.name, path + '/' + tileset.image); + }) + }); + this.load.tilemapTiledJSON(Textures.Map, mapUrl); this.load.image(Textures.Rock, 'resources/objects/rockSprite.png'); this.load.spritesheet(Textures.Player, 'resources/characters/pipoya/Male 01-1.png',