From 0b352fc5dc59bc6c2b633f19986f88e720f77150 Mon Sep 17 00:00:00 2001 From: kharhamel Date: Wed, 24 Mar 2021 15:59:18 +0100 Subject: [PATCH] FIX: help camera settings popup now only show up once --- front/src/Connexion/LocalUserStore.ts | 8 ++++++++ front/src/Phaser/Game/GameManager.ts | 5 ++++- front/src/Phaser/Menu/HelpCameraSettingsScene.ts | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/front/src/Connexion/LocalUserStore.ts b/front/src/Connexion/LocalUserStore.ts index 1e4267de..702df561 100644 --- a/front/src/Connexion/LocalUserStore.ts +++ b/front/src/Connexion/LocalUserStore.ts @@ -8,6 +8,7 @@ const gameQualityKey = 'gameQuality'; const videoQualityKey = 'videoQuality'; const audioPlayerVolumeKey = 'audioVolume'; const audioPlayerMuteKey = 'audioMute'; +const helpCameraSettingsShown = 'helpCameraSettingsShown'; class LocalUserStore { saveUser(localUser: LocalUser) { @@ -73,6 +74,13 @@ class LocalUserStore { getAudioPlayerMuted(): boolean { return localStorage.getItem(audioPlayerMuteKey) === 'true'; } + + setHelpCameraSettingsShown(): void { + localStorage.setItem(helpCameraSettingsShown, '1'); + } + getHelpCameraSettingsShown(): boolean { + return localStorage.getItem(helpCameraSettingsShown) === '1'; + } } export const localUserStore = new LocalUserStore(); diff --git a/front/src/Phaser/Game/GameManager.ts b/front/src/Phaser/Game/GameManager.ts index 7af1014b..8751796f 100644 --- a/front/src/Phaser/Game/GameManager.ts +++ b/front/src/Phaser/Game/GameManager.ts @@ -79,7 +79,10 @@ export class GameManager { console.log('starting '+ (this.currentGameSceneName || this.startRoom.id)) scenePlugin.start(this.currentGameSceneName || this.startRoom.id); scenePlugin.launch(MenuSceneName); - scenePlugin.launch(HelpCameraSettingsSceneName);//700 + + if (!localUserStore.getHelpCameraSettingsShown()) { + scenePlugin.launch(HelpCameraSettingsSceneName);//700 + } } public gameSceneIsCreated(scene: GameScene) { diff --git a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts index af4f4073..6a5db25a 100644 --- a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts +++ b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts @@ -1,5 +1,6 @@ import {mediaManager} from "../../WebRtc/MediaManager"; import {HtmlUtils} from "../../WebRtc/HtmlUtils"; +import {localUserStore} from "../../Connexion/LocalUserStore"; export const HelpCameraSettingsSceneName = 'HelpCameraSettingsScene'; const helpCameraSettings = 'helpCameraSettings'; @@ -19,6 +20,7 @@ export class HelpCameraSettingsScene extends Phaser.Scene { } create(){ + localUserStore.setHelpCameraSettingsShown(); this.createHelpCameraSettings(); }