From 8b099e5725d75604b00d86ff46a335d167ee7dde Mon Sep 17 00:00:00 2001 From: Kharhamel Date: Tue, 21 Sep 2021 14:24:15 +0200 Subject: [PATCH] FIX: added another catch case for default model --- front/src/Phaser/Entity/Character.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/front/src/Phaser/Entity/Character.ts b/front/src/Phaser/Entity/Character.ts index d962968e..dd802540 100644 --- a/front/src/Phaser/Entity/Character.ts +++ b/front/src/Phaser/Entity/Character.ts @@ -10,6 +10,7 @@ import { DEPTH_INGAME_TEXT_INDEX } from "../Game/DepthIndexes"; import { waScaleManager } from "../Services/WaScaleManager"; import type OutlinePipelinePlugin from "phaser3-rex-plugins/plugins/outlinepipeline-plugin.js"; import { isSilentStore } from "../../Stores/MediaStore"; +import { lazyLoadPlayerCharacterTextures } from "./PlayerTexturesLoadingManager"; const playerNameY = -25; @@ -57,10 +58,17 @@ export abstract class Character extends Container { this.sprites = new Map(); //textures are inside a Promise in case they need to be lazyloaded before use. - texturesPromise.then((textures) => { - this.addTextures(textures, frame); - this.invisible = false; - }); + texturesPromise + .then((textures) => { + this.addTextures(textures, frame); + this.invisible = false; + }) + .catch(() => { + return lazyLoadPlayerCharacterTextures(scene.load, ["color_22", "eyes_23"]).then((textures) => { + this.addTextures(textures, frame); + this.invisible = false; + }); + }); this.playerName = new Text(scene, 0, playerNameY, name, { fontFamily: '"Press Start 2P"',