From 282694fc99552afc7b8f8cbc9daf583a193b4f96 Mon Sep 17 00:00:00 2001 From: Piotr 'pwh' Hanusiak Date: Mon, 25 Apr 2022 16:55:34 +0200 Subject: [PATCH] change warning message --- front/src/Phaser/Login/CustomizeScene.ts | 30 ++++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index bc08136e..f07014b9 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -94,19 +94,7 @@ export class CustomizeScene extends AbstractCharacterScene { } public create(): void { - try { - const savedWokaLayers = gameManager.getCharacterLayers(); - if (savedWokaLayers && savedWokaLayers.length !== 0) { - this.selectedLayers = []; - for (let i = 0; i < savedWokaLayers.length; i += 1) { - this.selectedLayers.push( - this.layers[i].findIndex((item) => item.id === gameManager.getCharacterLayers()[i]) - ); - } - } - } catch (error) { - console.warn(error); - } + this.tryLoadLastUsedWokaLayers(); waScaleManager.zoomModifier = 1; this.createSlotBackgroundTextures(); this.initializeCustomWokaPreviewer(); @@ -162,6 +150,22 @@ export class CustomizeScene extends AbstractCharacterScene { this.scene.run(SelectCharacterSceneName); } + private tryLoadLastUsedWokaLayers(): void { + try { + const savedWokaLayers = gameManager.getCharacterLayers(); + if (savedWokaLayers && savedWokaLayers.length !== 0) { + this.selectedLayers = []; + for (let i = 0; i < savedWokaLayers.length; i += 1) { + this.selectedLayers.push( + this.layers[i].findIndex((item) => item.id === gameManager.getCharacterLayers()[i]) + ); + } + } + } catch { + console.warn("Cannot load previous WOKA"); + } + } + private createSlotBackgroundTextures(): void { for (let i = 0; i < 4; i += 1) { if (this.textures.getTextureKeys().includes(`floorTexture${i}`)) {