From 5bd524504492d9d808c6e2fb58136e1c81ea638b Mon Sep 17 00:00:00 2001 From: GRL Date: Wed, 2 Jun 2021 12:00:35 +0200 Subject: [PATCH] SelectCharacterScene and CustomCharacterScene mobile version --- .../CustomCharacterScene/CustomCharacterScene.svelte | 8 ++++---- .../selectCharacter/SelectCharacterScene.svelte | 8 ++++---- front/src/Enum/EnvironmentVariable.ts | 2 +- front/src/Phaser/Login/CustomizeScene.ts | 2 -- front/src/Phaser/Login/SelectCharacterScene.ts | 5 ++--- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/front/src/Components/CustomCharacterScene/CustomCharacterScene.svelte b/front/src/Components/CustomCharacterScene/CustomCharacterScene.svelte index e92b996e..f9e3a66b 100644 --- a/front/src/Components/CustomCharacterScene/CustomCharacterScene.svelte +++ b/front/src/Components/CustomCharacterScene/CustomCharacterScene.svelte @@ -107,11 +107,11 @@ } @media only screen and (max-width: 800px) { - .customCharacterScene button.customCharacterSceneButtonLeft{ - left: 10vw; + form.customCharacterScene button.customCharacterSceneButtonLeft{ + left: 5vw; } - .customCharacterScene button.customCharacterSceneButtonRight{ - right: 10vw; + form.customCharacterScene button.customCharacterSceneButtonRight{ + right: 5vw; } } diff --git a/front/src/Components/selectCharacter/SelectCharacterScene.svelte b/front/src/Components/selectCharacter/SelectCharacterScene.svelte index 716f77ef..e227771c 100644 --- a/front/src/Components/selectCharacter/SelectCharacterScene.svelte +++ b/front/src/Components/selectCharacter/SelectCharacterScene.svelte @@ -80,11 +80,11 @@ } @media only screen and (max-width: 800px) { - .selectCharacterScene button.selectCharacterButtonLeft{ - left: 10vw; + form.selectCharacterScene button.selectCharacterButtonLeft{ + left: 5vw; } - .selectCharacterScene button.selectCharacterButtonRight{ - right: 10vw; + form.selectCharacterScene button.selectCharacterButtonRight{ + right: 5vw; } } diff --git a/front/src/Enum/EnvironmentVariable.ts b/front/src/Enum/EnvironmentVariable.ts index 91e75187..73f6427c 100644 --- a/front/src/Enum/EnvironmentVariable.ts +++ b/front/src/Enum/EnvironmentVariable.ts @@ -16,7 +16,7 @@ export const MAX_USERNAME_LENGTH = parseInt(process.env.MAX_USERNAME_LENGTH || ' export const MAX_PER_GROUP = parseInt(process.env.MAX_PER_GROUP || '4'); export const DISPLAY_TERMS_OF_USE = process.env.DISPLAY_TERMS_OF_USE == 'true'; -export const isMobile = ():boolean => false;//( ( window.innerWidth <= 800 ) || ( window.innerHeight <= 600 ) ); +export const isMobile = ():boolean => ( ( window.innerWidth <= 800 ) || ( window.innerHeight <= 600 ) ); export { DEBUG_MODE, diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index 1715983b..b0a9f00a 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -242,7 +242,6 @@ export class CustomizeScene extends AbstractCharacterScene { gameManager.setCharacterLayers(layers); this.scene.sleep(CustomizeSceneName); - this.scene.remove(SelectCharacterSceneName); gameManager.tryResumingGame(this, EnableCameraSceneName); customCharacterSceneVisibleStore.set(false); } @@ -251,6 +250,5 @@ export class CustomizeScene extends AbstractCharacterScene { this.scene.sleep(CustomizeSceneName); this.scene.run(SelectCharacterSceneName); customCharacterSceneVisibleStore.set(false); - selectCharacterSceneVisibleStore.set(true); } } diff --git a/front/src/Phaser/Login/SelectCharacterScene.ts b/front/src/Phaser/Login/SelectCharacterScene.ts index 5133aab6..8c79e51b 100644 --- a/front/src/Phaser/Login/SelectCharacterScene.ts +++ b/front/src/Phaser/Login/SelectCharacterScene.ts @@ -52,6 +52,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { create() { selectCharacterSceneVisibleStore.set(true); + this.events.addListener('wake', () => {selectCharacterSceneVisibleStore.set(true);}); if (touchScreenManager.supportTouchScreen) { new PinchManager(this); @@ -63,7 +64,6 @@ export class SelectCharacterScene extends AbstractCharacterScene { /*create user*/ this.createCurrentPlayer(); - const playerNumber = localUserStore.getPlayerCharacterIndex(); this.input.keyboard.on('keyup-ENTER', () => { return this.nextSceneToCameraScene(); @@ -93,7 +93,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { this.scene.stop(SelectCharacterSceneName); gameManager.setCharacterLayers([this.selectedPlayer.texture.key]); gameManager.tryResumingGame(this, EnableCameraSceneName); - this.scene.remove(SelectCharacterSceneName); + this.players = []; selectCharacterSceneVisibleStore.set(false); } @@ -128,7 +128,6 @@ export class SelectCharacterScene extends AbstractCharacterScene { }); this.players.push(player); } - this.selectedPlayer = this.players[this.currentSelectUser]; this.selectedPlayer.play(this.playerModels[this.currentSelectUser].name); }