From 069f2f1cec1e1cd56e30113c68a7459c71397070 Mon Sep 17 00:00:00 2001 From: kharhamel Date: Fri, 4 Dec 2020 11:30:35 +0100 Subject: [PATCH] FEAT: prototype game menu using html elements, better icon for text chat --- front/dist/resources/fonts/ka1.ttf | Bin 0 -> 56908 bytes front/dist/resources/html/gameMenu.html | 34 ++++ front/dist/resources/html/gameMenuIcon.html | 16 ++ .../dist/resources/html/gameQualityMenu.html | 73 +++++++ front/dist/resources/objects/talk.png | Bin 0 -> 7940 bytes .../ConsoleGlobalMessageManager.ts | 110 +--------- front/src/Connexion/ConnectionManager.ts | 3 +- front/src/Connexion/LocalUserStore.ts | 25 +++ front/src/Connexion/RoomConnection.ts | 4 + front/src/Phaser/Components/ChatModeIcon.ts | 11 + front/src/Phaser/Components/OpenChatIcon.ts | 18 ++ .../Phaser/Components/PresentationModeIcon.ts | 11 + front/src/Phaser/Game/GameManager.ts | 57 +++++- front/src/Phaser/Game/GameScene.ts | 79 +++++--- front/src/Phaser/Login/CustomizeScene.ts | 5 +- front/src/Phaser/Login/EnableCameraScene.ts | 1 + front/src/Phaser/Login/EntryScene.ts | 16 +- front/src/Phaser/Login/LoginScene.ts | 9 +- .../src/Phaser/Login/SelectCharacterScene.ts | 5 +- front/src/Phaser/Menu/MenuScene.ts | 189 ++++++++++++++++++ front/src/WebRtc/DiscussionManager.ts | 40 +--- front/src/WebRtc/MediaManager.ts | 22 +- front/src/index.ts | 18 +- 23 files changed, 520 insertions(+), 226 deletions(-) create mode 100644 front/dist/resources/fonts/ka1.ttf create mode 100644 front/dist/resources/html/gameMenu.html create mode 100644 front/dist/resources/html/gameMenuIcon.html create mode 100644 front/dist/resources/html/gameQualityMenu.html create mode 100644 front/dist/resources/objects/talk.png create mode 100644 front/src/Phaser/Components/ChatModeIcon.ts create mode 100644 front/src/Phaser/Components/OpenChatIcon.ts create mode 100644 front/src/Phaser/Components/PresentationModeIcon.ts create mode 100644 front/src/Phaser/Menu/MenuScene.ts diff --git a/front/dist/resources/fonts/ka1.ttf b/front/dist/resources/fonts/ka1.ttf new file mode 100644 index 0000000000000000000000000000000000000000..d1df85235c97923dd54e9234999fe36452e309ba GIT binary patch literal 56908 zcmeHQ37lL-(XZ|~HhY8+Lc$$38#aJkd*y-vImiVe34{<11tzev16 z>g&y0PykR0=RypsX3aUE=81`y+z6n?Aotk%)>Qi|XCLxDCRhTHc(pOr*}iTari2xT zp}b#X%NYyqYrhyZ40#0L;ijf^s^PsGKAeEEC-E9Zi~&dYdll*b!)uSG)~>~0S)-Pr z{;L2=YFaY&sbsQdDZs$5p#EK3Q;XY+W~(2gd`C=Q-j-@jpY)9>4*)FN6?u=hXF9t+ zIDXf^0le@gz@QeOvg0+NuVzk@oT}8WL{8*2#@5MBD#gG@j-%tMm(htEh%3D;7`X+cG(YY?RMLPJ( zmDc4``IxspTTyc6aTzG2`z4)pZ>&34xXJ8O{cVqzUk6mj=6XH|lTx?eSPxj+}K81Bm zx@`H8Pcp+peUyh}(hl3B(5+i417Flme3^8phwbDG$u`*~{iZBb7g#332Dd%SOi1A~i{tS(P=+G}<#Wr&aY{>dofZ0RX6~EH zKp3Wa$1o=1Y^%_aFimNtUWpBR?^tHj2e1#BvXXrtcZqpkS&~ywhW#&wV??qBFC58| ziJ<=~e1G-sm(nHYd+C!8Vu<4p=a1it_OJHp z*tE?lNFy(P6JAtLU7kF45z=^1whc)}7y1zjW7m7K#03~)9mU?l@FNWO#_$xhS%o2% z&-fc0fvqjliE+%X@m_k9*Y7h$ z^_ULRnlz}-qLi z^5TP$M`<`e>N2*GPkE_+sqQE&8joquMLwo6WuSbhGxj^Y4oA6NFeeha{>E?QEZQ6T0)&X8|s;j|xfhVK3@ITt0 zHf|3wqSVfKVOAu~M`;Y`k{=Yt;)!HYzv7b8vi{o)*mmG{gSH<$WQQGh+Ig2$ILx;-f_pDaN=h_chbqHq+ou1LwZ4DQ}d|{TUy&P?Wc8gc6Fb=Xz>|m zp7r@JoPEx@U;NT}=U;H)MHhehl1neU{E92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u3~9*72Bw;VjI;}Y@@o0ZB$pW zjp{14QC-FNQC($iR9hQCnMX3OYV4TgyvB|c&fOMy!93&elZ#AHJdfQ#@gk;@$9oCS zFo7vQcJ!(-{kz*5(jA@knT~YB{FeTwb>lEVlfsV9bVIVWxs7HZo$2~aTSIYraXq># zOhxXhrmA+b7ml71Z)xsGCEL@T=;Dm#QPnj*7LoGXW>j_U$eQAGXBW<(a3iG{ruSPDk4JZwE@(cT>9S5NN1HDwPIYu-7PX`obQKw@yS>DO9i+n(He?pHdDQ$& zSCdC|w>Pwv`57A8=69w`G96t_G*qWr%9`8oUh(F-nlo*s>C?KKPfxX^+v?Marc8Hd zx<6J!3vK44T5xPEp~P5sEnV%FoZr=N&J;ugeuyv>5>=L{^+j0GUYe>pCdM!^mWfeJ zjAmk_Pt>uV8qPkFO^jsCwXCOxIW?T7hV__`idx5sYq=OTmSF2OT%KA>u&9nrRI?t# zAk8&g)H<7(HP>-@>bN|0tl8WaWgls8(CRT99QEe6Wa<|dVH;AI@M0|sys)Fok9XnB zry-p%-$e}zO<263xupfcomrfmhLtnAHaV?&%*Z+~7+GE7i8~MmMO_`usmAVhFYNH+ z4Q*b$WkHgrZ7pe&A4h=Zw$tb1IxXErlqV|5w5QvAW@l?N!ZlT&Mx32)BeBlzw&Vg_ z54EJ@^p)sr#}dcuTe{~bn$jsW+R&V8#qL(xid&5y_R`x3+V6k31gxX}hv7)vSySuQ Gf&PDRo=4yS literal 0 HcmV?d00001 diff --git a/front/dist/resources/html/gameMenu.html b/front/dist/resources/html/gameMenu.html new file mode 100644 index 00000000..a5190062 --- /dev/null +++ b/front/dist/resources/html/gameMenu.html @@ -0,0 +1,34 @@ + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
diff --git a/front/dist/resources/html/gameMenuIcon.html b/front/dist/resources/html/gameMenuIcon.html new file mode 100644 index 00000000..f7f5e9aa --- /dev/null +++ b/front/dist/resources/html/gameMenuIcon.html @@ -0,0 +1,16 @@ + +
+
+ +
+
\ No newline at end of file diff --git a/front/dist/resources/html/gameQualityMenu.html b/front/dist/resources/html/gameQualityMenu.html new file mode 100644 index 00000000..00599386 --- /dev/null +++ b/front/dist/resources/html/gameQualityMenu.html @@ -0,0 +1,73 @@ + + +
+
+

Game quality

+

(Editing this settings will restart the game)

+ +
+
+

Video quality

+ +
+
+ + +
+
diff --git a/front/dist/resources/objects/talk.png b/front/dist/resources/objects/talk.png new file mode 100644 index 0000000000000000000000000000000000000000..b9ecdb3043542e1f53dbbb99ca99ba183a2c52b1 GIT binary patch literal 7940 zcmeG>c{r47-;bP*w*{v<<&>CC3vVQ+ge+q^MUpHLvX0(DWvgsym?5DRNm?x9kdRQ8 z8QG?&6fs7!k7=x9n;8r0Nci zW?la4ORzkwwB%Xgr&CC3o z$bX+r)Y?em*`kSdXa6Qkl!!Bta7gZBaE~wXIp{osmRO^trc^zxN_Oq45}Jq^LOC5= zs!I#gs+=EADY3OeY8x;zqKdiItZ+vM2L}S#NN}dav#DYCtHH#H8>;Eol}oZ_xm+*Z zzRRa|{QIgVUQ5e=>J#*FJy~HR1|{KKs;x;(DDh350_=6VW|61;7m zCn2udUA~3Cp?hrT0lGPu7S27$4I4=dIZS(>+q{rtZT6;!@IX_sAFy5kr=YZVGzZ^z z7gIA{SefacJtU{k$cXEm@yE`jFq}7*EvBOr^Sz?~L?_L+_SyhcfF?i_ygd) z`=W5BnqZk42`3TIvPGidrWA#6Oq9-Vzgc%9HBY|S!k_zbvIr;gKF19c&jUUC7T7e1 zjY95+OWj8Uo1Mdvx=OsjNk%oN)jXRzvqClXCqQEk$e0{V_Da2Ym@|2&0#vzz308nZ zmxA@<2EHJC(i?rNrtEk1nU;WNy%A$@y}+4RSc<6uiIC;*-{t|zqX!OO*-#VF%6TJ? zeUU_>?Rem_Hr)HrTspTZCkazC{Mb9w-}ggs_qiM!=6tfV-;J8G1+Da;-0V1%m}eu# zdbd9Z&|g!KnBbjUAuu$sRDx1)=P6(olw_XFa8?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Pc|E&G~gUv39lbL2+0F9RxixY33Lx={XXCBQi420;(sZs9eL^jhtF}8Xw<4lA9A@e znoZaGTnr1CyVLgRnG{`rzj^3FtC?yv`B)pna(u6J+mGM#!q@cYcfo&{N?F-&++yG#W{#wf*0)yv+Ra-(`H9&hMnq^ejTmg z_KVRrUs&eHC#$c_Cdfo+VyAA=XDAETZ-C+;7YcRylSH*6SsJj++lbWQ9=QcadQhoU zddVW@-8b0H3@aSpmgiEc0fak0+-j~#WkMGkHHg>9#yzkOo+`&4CV4puX9SBx7KLaQXJkQGGV+qlqhREIluckfm(vzU_(q~!-uqt_a0mEnDK8lZ81IxRq t5hqOp;OjPIW@2evc+maozX4$ { - this.saveSetting(selectGame.value, selectVideo.value); - this.disabledSettingConsole(); - }); - divButtonAction.appendChild(buttonSave); - - const section = document.createElement('section'); - section.id = this.getSectionId(VIDEO_QUALITY_CONSOLE); - section.appendChild(labelGame); - section.appendChild(selectGame); - section.appendChild(labelVideo); - section.appendChild(selectVideo); - section.appendChild(divButtonAction); - this.divSettingConsole.appendChild(section); - } - private static loadCss(): Promise { return new Promise((resolve, reject) => { if (ConsoleGlobalMessageManager.cssLoaded) { @@ -421,19 +330,6 @@ export class ConsoleGlobalMessageManager { this.Connection.emitGlobalMessage(GlobalMessage); } - private saveSetting(valueGame: string, valueVideo: string){ - const previousGameValue = localStorage.getItem(GAME_QUALITY_SELECT); - if(!previousGameValue || previousGameValue !== valueGame) { - localStorage.setItem(GAME_QUALITY_SELECT, valueGame); - window.location.reload(); - } - const previousVideoValue = localStorage.getItem(VIDEO_QUALITY_SELECT); - if(!previousVideoValue || previousVideoValue !== valueVideo) { - localStorage.setItem(VIDEO_QUALITY_SELECT, valueVideo); - mediaManager.updateCameraQuality(parseInt(valueVideo)); - } - } - active(){ this.userInputManager.clearAllInputKeyboard(); this.divMainConsole.style.top = '0'; @@ -453,12 +349,14 @@ export class ConsoleGlobalMessageManager { } this.active(); this.divMessageConsole.classList.add('active'); + this.buttonMainConsole.hidden = false; this.buttonSendMainConsole.classList.add('active'); } disabledMessageConsole(){ this.activeMessage = false; this.disabled(); + this.buttonMainConsole.hidden = false; this.divMessageConsole.classList.remove('active'); this.buttonSendMainConsole.classList.remove('active'); } diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index b670a388..a113a00c 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -55,8 +55,7 @@ class ConnectionManager { } else { roomId = window.location.pathname + window.location.hash; } - const room = new Room(roomId); - return Promise.resolve(room); + return Promise.resolve(new Room(roomId)); } return Promise.reject('Invalid URL'); diff --git a/front/src/Connexion/LocalUserStore.ts b/front/src/Connexion/LocalUserStore.ts index afe01bcd..8ac8c7b2 100644 --- a/front/src/Connexion/LocalUserStore.ts +++ b/front/src/Connexion/LocalUserStore.ts @@ -1,5 +1,9 @@ import {LocalUser} from "./LocalUser"; +const characterLayersKey = 'characterLayers'; +const gameQualityKey = 'gameQuality'; +const videoQualityKey = 'videoQuality'; + //todo: add localstorage fallback class LocalUserStore { @@ -31,6 +35,27 @@ class LocalUserStore { getCustomCursorPosition(): {activeRow:number, selectedLayers:number[]}|null { return JSON.parse(window.localStorage.getItem('customCursorPosition') || "null"); } + + setCharacterLayers(layers: string[]): void { + window.localStorage.setItem(characterLayersKey, JSON.stringify(layers)); + } + getCharacterLayers(): string[]|null { + return JSON.parse(window.localStorage.getItem(characterLayersKey) || "null"); + } + + getGameQualityValue(): number { + return parseInt(window.localStorage.getItem(gameQualityKey) || '') || 60; + } + setGameQualityValue(value: number): void { + localStorage.setItem(gameQualityKey, '' + value); + } + + getVideoQualityValue(): number { + return parseInt(window.localStorage.getItem(videoQualityKey) || '') || 20; + } + setVideoQualityValue(value: number): void { + localStorage.setItem(videoQualityKey, '' + value); + } } export const localUserStore = new LocalUserStore(); \ No newline at end of file diff --git a/front/src/Connexion/RoomConnection.ts b/front/src/Connexion/RoomConnection.ts index cc033974..beb7f9dd 100644 --- a/front/src/Connexion/RoomConnection.ts +++ b/front/src/Connexion/RoomConnection.ts @@ -583,4 +583,8 @@ export class RoomConnection implements RoomConnection { public hasTag(tag: string): boolean { return this.tags.includes(tag); } + + public isAdmin(): boolean { + return this.hasTag('admin'); + } } diff --git a/front/src/Phaser/Components/ChatModeIcon.ts b/front/src/Phaser/Components/ChatModeIcon.ts new file mode 100644 index 00000000..932a4d88 --- /dev/null +++ b/front/src/Phaser/Components/ChatModeIcon.ts @@ -0,0 +1,11 @@ +export class ChatModeIcon extends Phaser.GameObjects.Sprite { + constructor(scene: Phaser.Scene, x: number, y: number) { + super(scene, x, y, 'layout_modes', 3); + scene.add.existing(this); + this.setScrollFactor(0, 0); + this.setOrigin(0, 1); + this.setInteractive(); + this.setVisible(false); + this.setDepth(99999); + } +} \ No newline at end of file diff --git a/front/src/Phaser/Components/OpenChatIcon.ts b/front/src/Phaser/Components/OpenChatIcon.ts new file mode 100644 index 00000000..bf293bab --- /dev/null +++ b/front/src/Phaser/Components/OpenChatIcon.ts @@ -0,0 +1,18 @@ +import {discussionManager} from "../../WebRtc/DiscussionManager"; + +export const openChatIconName = 'openChatIcon'; +export class OpenChatIcon extends Phaser.GameObjects.Image { + constructor(scene: Phaser.Scene, x: number, y: number) { + super(scene, x, y, openChatIconName); + scene.add.existing(this); + this.setScrollFactor(0, 0); + this.setOrigin(0, 1); + this.displayWidth = 30; + this.displayHeight = 30; + this.setInteractive(); + this.setVisible(false) + this.setDepth(99999); + + this.on("pointerup", () => discussionManager.showDiscussionPart()); + } +} \ No newline at end of file diff --git a/front/src/Phaser/Components/PresentationModeIcon.ts b/front/src/Phaser/Components/PresentationModeIcon.ts new file mode 100644 index 00000000..49ff2ea1 --- /dev/null +++ b/front/src/Phaser/Components/PresentationModeIcon.ts @@ -0,0 +1,11 @@ +export class PresentationModeIcon extends Phaser.GameObjects.Sprite { + constructor(scene: Phaser.Scene, x: number, y: number) { + super(scene, x, y, 'layout_modes', 0); + scene.add.existing(this); + this.setScrollFactor(0, 0); + this.setOrigin(0, 1); + this.setInteractive(); + this.setVisible(false); + this.setDepth(99999); + } +} \ No newline at end of file diff --git a/front/src/Phaser/Game/GameManager.ts b/front/src/Phaser/Game/GameManager.ts index cc575b6a..88ed1c52 100644 --- a/front/src/Phaser/Game/GameManager.ts +++ b/front/src/Phaser/Game/GameManager.ts @@ -1,6 +1,11 @@ import {GameScene} from "./GameScene"; import {connectionManager} from "../../Connexion/ConnectionManager"; import {Room} from "../../Connexion/Room"; +import {MenuSceneName} from "../Menu/MenuScene"; +import {LoginSceneName} from "../Login/LoginScene"; +import {SelectCharacterSceneName} from "../Login/SelectCharacterScene"; +import {EnableCameraSceneName} from "../Login/EnableCameraScene"; +import {localUserStore} from "../../Connexion/LocalUserStore"; export interface HasMovedEvent { direction: string; @@ -9,29 +14,48 @@ export interface HasMovedEvent { y: number; } +/** + * This class should be responsible for any scene starting/stopping + */ export class GameManager { - private playerName!: string; - private characterLayers!: string[]; + private playerName: string|null; + private characterLayers: string[]|null; private startRoom!:Room; + currentSceneName: string|null = null; + + constructor() { + this.playerName = localUserStore.getName(); + this.characterLayers = localUserStore.getCharacterLayers(); + } - public async init(scenePlugin: Phaser.Scenes.ScenePlugin) { + public async init(scenePlugin: Phaser.Scenes.ScenePlugin): Promise { this.startRoom = await connectionManager.initGameConnexion(); await this.loadMap(this.startRoom, scenePlugin); + + if (!this.playerName) { + return LoginSceneName; + } else if (!this.characterLayers) { + return SelectCharacterSceneName; + } else { + return EnableCameraSceneName; + } } public setPlayerName(name: string): void { this.playerName = name; + localUserStore.setName(name); } public setCharacterLayers(layers: string[]): void { this.characterLayers = layers; + localUserStore.setCharacterLayers(layers); } - getPlayerName(): string { + getPlayerName(): string|null { return this.playerName; } - getCharacterSelected(): string[] { + getCharacterLayers(): string[]|null { return this.characterLayers; } @@ -48,7 +72,28 @@ export class GameManager { } public goToStartingMap(scenePlugin: Phaser.Scenes.ScenePlugin): void { - scenePlugin.start(this.startRoom.id); + console.log('starting '+ (this.currentSceneName || this.startRoom.id)) + scenePlugin.start(this.currentSceneName || this.startRoom.id); + //the menu scene launches faster than the gameScene, so we delay it to not have menu buttons on a black screen + setTimeout(() => scenePlugin.launch(MenuSceneName), 1000); + } + + /** + * Temporary leave a gameScene to go back to the loginScene for example. + * This will close the socket connections and stop the gameScene, but won't remove it. + */ + leaveGame(scene: Phaser.Scene, targetSceneName: string): void { + if (this.currentSceneName === null) throw 'No current scene id set!'; + const gameScene: GameScene = scene.scene.get(this.currentSceneName) as GameScene; + gameScene.cleanupClosingScene(); + scene.scene.stop(this.currentSceneName); + scene.scene.stop(MenuSceneName); + scene.scene.run(targetSceneName); + } + + public getCurrentGameScene(scene: Phaser.Scene): GameScene { + if (this.currentSceneName === null) throw 'No current scene id set!'; + return scene.scene.get(this.currentSceneName) as GameScene } } diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index d7ca5adc..cbfa64d9 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -1,4 +1,4 @@ -import {GameManager, gameManager, HasMovedEvent} from "./GameManager"; +import {gameManager, HasMovedEvent} from "./GameManager"; import { GroupCreatedUpdatedMessageInterface, MessageUserJoined, @@ -60,6 +60,9 @@ import {ResizableScene} from "../Login/ResizableScene"; import {Room} from "../../Connexion/Room"; import {jitsiFactory} from "../../WebRtc/JitsiFactory"; import {urlManager} from "../../Url/UrlManager"; +import {PresentationModeIcon} from "../Components/PresentationModeIcon"; +import {ChatModeIcon} from "../Components/ChatModeIcon"; +import {OpenChatIcon, openChatIconName} from "../Components/OpenChatIcon"; export interface GameSceneInitInterface { initPosition: PointInterface|null, @@ -99,7 +102,6 @@ interface DeleteGroupEventInterface { const defaultStartLayerName = 'start'; export class GameScene extends ResizableScene implements CenterListener { - GameManager : GameManager; Terrains : Array; CurrentPlayer!: CurrentGamerInterface; MapPlayers!: Phaser.Physics.Arcade.Group; @@ -116,11 +118,11 @@ export class GameScene extends ResizableScene implements CenterListener { pendingEvents: Queue = new Queue(); private initPosition: PositionInterface|null = null; private playersPositionInterpolator = new PlayersPositionInterpolator(); - private connection!: RoomConnection; + public connection!: RoomConnection; private simplePeer!: SimplePeer; private GlobalMessageManager!: GlobalMessageManager; private UserMessageManager!: UserMessageManager; - private ConsoleGlobalMessageManager!: ConsoleGlobalMessageManager; + public ConsoleGlobalMessageManager!: ConsoleGlobalMessageManager; private connectionAnswerPromise: Promise; private connectionAnswerPromiseResolve!: (value?: RoomJoinedMessageInterface | PromiseLike) => void; // A promise that will resolve when the "create" method is called (signaling loading is ended) @@ -149,16 +151,18 @@ export class GameScene extends ResizableScene implements CenterListener { private userInputManager!: UserInputManager; private isReconnecting: boolean = false; private startLayerName!: string | null; + private openChatIcon!: OpenChatIcon; + private playerName!: string; + private characterLayers!: string[]; constructor(private room: Room, MapUrlFile: string) { super({ key: room.id }); - - this.GameManager = gameManager; this.Terrains = []; this.groups = new Map(); this.instance = room.getInstance(); + this.MapUrlFile = MapUrlFile; this.RoomId = room.id; @@ -173,6 +177,7 @@ export class GameScene extends ResizableScene implements CenterListener { //hook preload scene preload(): void { + this.load.image(openChatIconName, 'resources/objects/talk.png'); this.load.on(FILE_LOAD_ERROR, (file: {src: string}) => { this.scene.start(FourOFourSceneName, { file: file.src @@ -306,9 +311,22 @@ export class GameScene extends ResizableScene implements CenterListener { //hook create scene create(): void { + gameManager.currentSceneName = this.scene.key; urlManager.pushRoomIdToUrl(this.room); this.startLayerName = urlManager.getStartLayerNameFromUrl(); + const playerName = gameManager.getPlayerName(); + if (!playerName) { + throw 'playerName is not set'; + } + this.playerName = playerName; + const characterLayers = gameManager.getCharacterLayers(); + if (!characterLayers) { + throw 'characterLayers are not set'; + } + this.characterLayers = characterLayers; + + //initalise map this.Map = this.add.tilemap(this.MapUrlFile); this.gameMap = new GameMap(this.mapFile); @@ -415,23 +433,14 @@ export class GameScene extends ResizableScene implements CenterListener { this.outlinedItem?.activate(); }); - this.presentationModeSprite = this.add.sprite(2, this.game.renderer.height - 2, 'layout_modes', 0); - this.presentationModeSprite.setScrollFactor(0, 0); - this.presentationModeSprite.setOrigin(0, 1); - this.presentationModeSprite.setInteractive(); - this.presentationModeSprite.setVisible(false); - this.presentationModeSprite.setDepth(99999); + this.presentationModeSprite = new PresentationModeIcon(this, 36, this.game.renderer.height - 2); this.presentationModeSprite.on('pointerup', this.switchLayoutMode.bind(this)); - this.chatModeSprite = this.add.sprite(36, this.game.renderer.height - 2, 'layout_modes', 3); - this.chatModeSprite.setScrollFactor(0, 0); - this.chatModeSprite.setOrigin(0, 1); - this.chatModeSprite.setInteractive(); - this.chatModeSprite.setVisible(false); - this.chatModeSprite.setDepth(99999); + this.chatModeSprite = new ChatModeIcon(this, 70, this.game.renderer.height - 2); this.chatModeSprite.on('pointerup', this.switchLayoutMode.bind(this)); + this.openChatIcon = new OpenChatIcon(this, 2, this.game.renderer.height - 36) // FIXME: change this to use the UserInputManager class for input - this.input.keyboard.on('keyup-' + 'M', () => { + this.input.keyboard.on('keyup-M', () => { this.switchLayoutMode(); }); @@ -445,8 +454,8 @@ export class GameScene extends ResizableScene implements CenterListener { connectionManager.connectToRoomSocket( this.RoomId, - gameManager.getPlayerName(), - gameManager.getCharacterSelected(), + this.playerName, + this.characterLayers, { x: this.startX, y: this.startY @@ -459,10 +468,6 @@ export class GameScene extends ResizableScene implements CenterListener { }).then((onConnect: OnConnectInterface) => { this.connection = onConnect.connection; - //this.connection.emitPlayerDetailsMessage(gameManager.getPlayerName(), gameManager.getCharacterSelected()) - /*this.connection.onStartRoom((roomJoinedMessage: RoomJoinedMessageInterface) => { - - });*/ this.connection.onUserJoins((message: MessageUserJoined) => { const userMessage: AddPlayerInterface = { userId: message.userId, @@ -493,11 +498,13 @@ export class GameScene extends ResizableScene implements CenterListener { this.connection.onGroupUpdatedOrCreated((groupPositionMessage: GroupCreatedUpdatedMessageInterface) => { this.shareGroupPosition(groupPositionMessage); + this.openChatIcon.setVisible(true); }) this.connection.onGroupDeleted((groupId: number) => { try { this.deleteGroup(groupId); + this.openChatIcon.setVisible(false); } catch (e) { console.error(e); } @@ -541,7 +548,7 @@ export class GameScene extends ResizableScene implements CenterListener { }); // When connection is performed, let's connect SimplePeer - this.simplePeer = new SimplePeer(this.connection, !this.room.isPublic, this.GameManager.getPlayerName()); + this.simplePeer = new SimplePeer(this.connection, !this.room.isPublic, this.playerName); this.GlobalMessageManager = new GlobalMessageManager(this.connection); this.UserMessageManager = new UserMessageManager(this.connection); @@ -569,7 +576,7 @@ export class GameScene extends ResizableScene implements CenterListener { //this.initUsersPosition(roomJoinedMessage.users); this.connectionAnswerPromiseResolve(onConnect.room); // Analyze tags to find if we are admin. If yes, show console. - this.ConsoleGlobalMessageManager = new ConsoleGlobalMessageManager(this.connection, this.userInputManager, this.connection.hasTag('admin')); + this.ConsoleGlobalMessageManager = new ConsoleGlobalMessageManager(this.connection, this.userInputManager, this.connection.isAdmin()); this.scene.wake(); @@ -649,9 +656,7 @@ export class GameScene extends ResizableScene implements CenterListener { if (!roomId) throw new Error('Could not find the room from its exit key: '+exitKey); urlManager.pushStartLayerNameToUrl(hash); if (roomId !== this.scene.key) { - // We are completely destroying the current scene to avoid using a half-backed instance when coming back to the same map. - this.connection.closeConnection(); - this.simplePeer.unregister(); + this.cleanupClosingScene(); this.scene.stop(); this.scene.remove(this.scene.key); this.scene.start(roomId); @@ -663,6 +668,12 @@ export class GameScene extends ResizableScene implements CenterListener { } } + public cleanupClosingScene(): void { + // We are completely destroying the current scene to avoid using a half-backed instance when coming back to the same map. + this.connection.closeConnection(); + this.simplePeer.unregister(); + } + private switchLayoutMode(): void { //if discussion is activated, this layout cannot be activated if(mediaManager.activatedDiscussion){ @@ -811,8 +822,8 @@ export class GameScene extends ResizableScene implements CenterListener { this, this.startX, this.startY, - this.GameManager.getPlayerName(), - this.GameManager.getCharacterSelected(), + this.playerName, + this.characterLayers, PlayerAnimationNames.WalkDown, false, this.userInputManager @@ -1174,7 +1185,7 @@ export class GameScene extends ResizableScene implements CenterListener { } public startJitsi(roomName: string, jwt?: string): void { - jitsiFactory.start(roomName, gameManager.getPlayerName(), jwt); + jitsiFactory.start(roomName, this.playerName, jwt); this.connection.setSilent(true); mediaManager.hideGameOverlay(); @@ -1209,4 +1220,6 @@ export class GameScene extends ResizableScene implements CenterListener { }); })) } + + } diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index 41ec95c9..d9236c06 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -9,6 +9,8 @@ import {gameManager} from "../Game/GameManager"; import {ResizableScene} from "./ResizableScene"; import {localUserStore} from "../../Connexion/LocalUserStore"; import {PlayerResourceDescriptionInterface} from "../Entity/Character"; +import {SelectCharacterSceneName} from "./SelectCharacterScene"; +import {LoginSceneName} from "./LoginScene"; export const CustomizeSceneName = "CustomizeScene"; @@ -120,7 +122,8 @@ export class CustomizeScene extends ResizableScene { gameManager.setCharacterLayers(layers); - return this.scene.start(EnableCameraSceneName); + this.scene.sleep(CustomizeSceneName) + this.scene.run(EnableCameraSceneName); }); this.input.keyboard.on('keydown-RIGHT', () => this.moveCursorHorizontally(1)); diff --git a/front/src/Phaser/Login/EnableCameraScene.ts b/front/src/Phaser/Login/EnableCameraScene.ts index 56502704..3cee733e 100644 --- a/front/src/Phaser/Login/EnableCameraScene.ts +++ b/front/src/Phaser/Login/EnableCameraScene.ts @@ -263,6 +263,7 @@ export class EnableCameraScene extends Phaser.Scene { mediaManager.stopCamera(); mediaManager.stopMicrophone(); + this.scene.sleep(EnableCameraSceneName) gameManager.goToStartingMap(this.scene); } diff --git a/front/src/Phaser/Login/EntryScene.ts b/front/src/Phaser/Login/EntryScene.ts index 6a91be1f..c7527349 100644 --- a/front/src/Phaser/Login/EntryScene.ts +++ b/front/src/Phaser/Login/EntryScene.ts @@ -1,13 +1,4 @@ import {gameManager} from "../Game/GameManager"; -import {TextField} from "../Components/TextField"; -import {TextInput} from "../Components/TextInput"; -import {ClickButton} from "../Components/ClickButton"; -import Image = Phaser.GameObjects.Image; -import Rectangle = Phaser.GameObjects.Rectangle; -import {PLAYER_RESOURCES, PlayerResourceDescriptionInterface} from "../Entity/Character"; -import {cypressAsserter} from "../../Cypress/CypressAsserter"; -import {SelectCharacterSceneName} from "./SelectCharacterScene"; -import {ResizableScene} from "./ResizableScene"; import {Scene} from "phaser"; import {LoginSceneName} from "./LoginScene"; import {FourOFourSceneName} from "../Reconnecting/FourOFourScene"; @@ -25,12 +16,9 @@ export class EntryScene extends Scene { }); } - preload() { - } - create() { - gameManager.init(this.scene).then(() => { - this.scene.start(LoginSceneName); + gameManager.init(this.scene).then((nextSceneName) => { + this.scene.start(nextSceneName); }).catch((err) => { console.error(err) this.scene.start(FourOFourSceneName, { diff --git a/front/src/Phaser/Login/LoginScene.ts b/front/src/Phaser/Login/LoginScene.ts index 2c5c1882..e828f8cb 100644 --- a/front/src/Phaser/Login/LoginScene.ts +++ b/front/src/Phaser/Login/LoginScene.ts @@ -1,14 +1,11 @@ import {gameManager} from "../Game/GameManager"; import {TextField} from "../Components/TextField"; import {TextInput} from "../Components/TextInput"; -import {ClickButton} from "../Components/ClickButton"; import Image = Phaser.GameObjects.Image; -import Rectangle = Phaser.GameObjects.Rectangle; import {PLAYER_RESOURCES, PlayerResourceDescriptionInterface} from "../Entity/Character"; import {cypressAsserter} from "../../Cypress/CypressAsserter"; import {SelectCharacterSceneName} from "./SelectCharacterScene"; import {ResizableScene} from "./ResizableScene"; -import {localUserStore} from "../../Connexion/LocalUserStore"; //todo: put this constants in a dedicated file export const LoginSceneName = "LoginScene"; @@ -29,7 +26,7 @@ export class LoginScene extends ResizableScene { super({ key: LoginSceneName }); - this.name = localUserStore.getName(); + this.name = gameManager.getPlayerName() || ''; } preload() { @@ -55,7 +52,6 @@ export class LoginScene extends ResizableScene { this.textField = new TextField(this, this.game.renderer.width / 2, 50, 'Enter your name:'); this.nameInput = new TextInput(this, this.game.renderer.width / 2, 70, 8, this.name,(text: string) => { this.name = text; - localUserStore.setName(text); }); this.pressReturnField = new TextField(this, this.game.renderer.width / 2, 130, 'Press enter to start'); @@ -87,7 +83,8 @@ export class LoginScene extends ResizableScene { private login(name: string): void { gameManager.setPlayerName(name); - this.scene.start(SelectCharacterSceneName); + this.scene.sleep(LoginSceneName) + this.scene.run(SelectCharacterSceneName); } public onResize(ev: UIEvent): void { diff --git a/front/src/Phaser/Login/SelectCharacterScene.ts b/front/src/Phaser/Login/SelectCharacterScene.ts index 25332b7d..5b4dc6cf 100644 --- a/front/src/Phaser/Login/SelectCharacterScene.ts +++ b/front/src/Phaser/Login/SelectCharacterScene.ts @@ -116,11 +116,12 @@ export class SelectCharacterScene extends ResizableScene { } private nextScene(): void { + this.scene.sleep(SelectCharacterSceneName); if (this.selectedPlayer !== null) { gameManager.setCharacterLayers([this.selectedPlayer.texture.key]); - this.scene.start(EnableCameraSceneName); + this.scene.run(EnableCameraSceneName); } else { - this.scene.start(CustomizeSceneName); + this.scene.run(CustomizeSceneName); } } diff --git a/front/src/Phaser/Menu/MenuScene.ts b/front/src/Phaser/Menu/MenuScene.ts new file mode 100644 index 00000000..5d796d00 --- /dev/null +++ b/front/src/Phaser/Menu/MenuScene.ts @@ -0,0 +1,189 @@ +import {LoginSceneName} from "../Login/LoginScene"; +import {SelectCharacterSceneName} from "../Login/SelectCharacterScene"; +import {gameManager} from "../Game/GameManager"; +import {localUserStore} from "../../Connexion/LocalUserStore"; +import {mediaManager} from "../../WebRtc/MediaManager"; + +export const MenuSceneName = 'MenuScene'; +const gameMenuKey = 'gameMenu'; +const gameMenuIconKey = 'gameMenuIcon'; +const gameSettingsMenuKey = 'gameSettingsMenu'; + +const closedSideMenuX = -200; +const openedSideMenuX = 0; + +/** + * The scene that manages the game menu, rendered using a DOM element. + */ +export class MenuScene extends Phaser.Scene { + private menuElement!: Phaser.GameObjects.DOMElement; + private gameQualityMenuElement!: Phaser.GameObjects.DOMElement; + private sideMenuOpened = false; + private settingsMenuOpened = false; + private gameQualityValue: number; + private videoQualityValue: number; + private menuButton!: Phaser.GameObjects.DOMElement; + + constructor() { + super({key: MenuSceneName}); + + this.gameQualityValue = localUserStore.getGameQualityValue(); + this.videoQualityValue = localUserStore.getVideoQualityValue(); + } + + preload () { + this.load.html(gameMenuKey, 'resources/html/gameMenu.html'); + this.load.html(gameMenuIconKey, 'resources/html/gameMenuIcon.html'); + this.load.html(gameSettingsMenuKey, 'resources/html/gameQualityMenu.html'); + } + + create() { + this.menuElement = this.add.dom(closedSideMenuX, 25).createFromCache(gameMenuKey); + this.menuElement.setOrigin(0); + + this.gameQualityMenuElement = this.add.dom(this.game.renderer.width / 2, -400).createFromCache(gameSettingsMenuKey); + this.gameQualityMenuElement.setOrigin(0.5); + + this.input.keyboard.on('keyup-TAB', () => { + this.sideMenuOpened ? this.closeSideMenu() : this.openSideMenu(); + }); + this.menuButton = this.add.dom(35, 20).createFromCache(gameMenuIconKey); + this.menuButton.addListener('click'); + this.menuButton.on('click', () => { + this.sideMenuOpened ? this.closeSideMenu() : this.openSideMenu(); + }); + } + + openSideMenu() { + if (this.sideMenuOpened) return; + this.sideMenuOpened = true; + this.menuButton.getChildByID('openMenuButton').innerHTML = 'Close' + if (gameManager.getCurrentGameScene(this).connection.isAdmin()) { + const adminSection = this.menuElement.getChildByID('adminConsoleSection') as HTMLElement; + adminSection.hidden = false; + } + this.menuElement.addListener('click'); + this.menuElement.on('click', this.onMenuClick.bind(this)); + this.tweens.add({ + targets: this.menuElement, + x: openedSideMenuX, + duration: 500, + ease: 'Power3' + }); + } + + private closeSideMenu(): void { + if (!this.sideMenuOpened) return; + this.sideMenuOpened = false; + this.closeGameQualityMenu() + this.menuButton.getChildByID('openMenuButton').innerHTML = 'Menu' + this.tweens.add({ + targets: this.menuElement, + x: closedSideMenuX, + duration: 500, + ease: 'Power3' + }); + this.menuElement.removeListener('click'); + } + + + + private openGameSettingsMenu(): void { + if (this.settingsMenuOpened) return; + this.settingsMenuOpened = true; + + const gameQualitySelect = this.gameQualityMenuElement.getChildByID('select-game-quality') as HTMLInputElement; + gameQualitySelect.value = ''+this.gameQualityValue; + const videoQualitySelect = this.gameQualityMenuElement.getChildByID('select-video-quality') as HTMLInputElement; + videoQualitySelect.value = ''+this.videoQualityValue; + + this.gameQualityMenuElement.addListener('click'); + this.gameQualityMenuElement.on('click', (event:MouseEvent) => { + event.preventDefault(); + if ((event?.target as HTMLInputElement).id === 'gameQualityFormSubmit') { + const gameQualitySelect = this.gameQualityMenuElement.getChildByID('select-game-quality') as HTMLInputElement; + const videoQualitySelect = this.gameQualityMenuElement.getChildByID('select-video-quality') as HTMLInputElement; + this.saveSetting(parseInt(gameQualitySelect.value), parseInt(videoQualitySelect.value)); + } else if((event?.target as HTMLInputElement).id === 'gameQualityFormCancel') { + this.closeGameQualityMenu(); + } + }); + + this.tweens.add({ + targets: this.gameQualityMenuElement, + y: this.game.renderer.height / 2, + duration: 1000, + ease: 'Power3' + }); + } + + private closeGameQualityMenu(): void { + if (!this.settingsMenuOpened) return; + this.settingsMenuOpened = false; + + this.gameQualityMenuElement.removeListener('click'); + this.tweens.add({ + targets: this.gameQualityMenuElement, + y: -400, + duration: 1000, + ease: 'Power3' + }); + } + + + + private onMenuClick(event:MouseEvent) { + event.preventDefault(); + + switch ((event?.target as HTMLInputElement).id) { + case 'changeNameButton': + this.closeSideMenu(); + this.closeGameQualityMenu(); + gameManager.leaveGame(this, LoginSceneName); + break; + case 'sparkButton': + this.goToSpark(); + break; + case 'changeSkinButton': + this.closeSideMenu(); + gameManager.leaveGame(this, SelectCharacterSceneName); + break; + case 'closeButton': + this.closeSideMenu(); + break; + case 'shareButton': + this.shareUrl(); + break; + case 'editGameSettingsButton': + this.openGameSettingsMenu(); + break; + case 'adminConsoleButton': + gameManager.getCurrentGameScene(this).ConsoleGlobalMessageManager.activeMessageConsole(); + break; + } + } + + private async shareUrl() { + await navigator.clipboard.writeText(location.toString()); + alert('URL was copy to your clipboard!'); + } + + private saveSetting(valueGame: number, valueVideo: number){ + if (valueGame !== this.gameQualityValue) { + this.gameQualityValue = valueGame; + localUserStore.setGameQualityValue(valueGame); + window.location.reload(); + } + if (valueVideo !== this.videoQualityValue) { + this.videoQualityValue = valueVideo; + localUserStore.setVideoQualityValue(valueVideo); + mediaManager.updateCameraQuality(valueVideo); + } + this.closeGameQualityMenu(); + } + + private goToSpark() { + const sparkHost = 'https://'+window.location.host.replace('play.', 'admin.')+'/register'; + window.location.assign(sparkHost); + } +} \ No newline at end of file diff --git a/front/src/WebRtc/DiscussionManager.ts b/front/src/WebRtc/DiscussionManager.ts index 053a2f44..583b1384 100644 --- a/front/src/WebRtc/DiscussionManager.ts +++ b/front/src/WebRtc/DiscussionManager.ts @@ -1,5 +1,5 @@ import {HtmlUtils} from "./HtmlUtils"; -import {MediaManager, ReportCallback, UpdatedLocalStreamCallback} from "./MediaManager"; +import {mediaManager, ReportCallback} from "./MediaManager"; import {UserInputManager} from "../Phaser/UserInput/UserInputManager"; import {connectionManager} from "../Connexion/ConnectionManager"; import {GameConnexionTypes} from "../Url/UrlManager"; @@ -13,7 +13,6 @@ export class DiscussionManager { private divParticipants?: HTMLDivElement; private nbpParticipants?: HTMLParagraphElement; private divMessages?: HTMLParagraphElement; - private buttonActiveDiscussion?: HTMLButtonElement; private participants: Map = new Map(); @@ -23,9 +22,9 @@ export class DiscussionManager { private userInputManager?: UserInputManager; - constructor(private mediaManager: MediaManager, name: string) { + constructor() { this.mainContainer = HtmlUtils.getElementByIdOrFail('main-container'); - this.createDiscussPart(name); + this.createDiscussPart(''); //todo: why do we always use empty string? } private createDiscussPart(name: string) { @@ -33,20 +32,12 @@ export class DiscussionManager { this.divDiscuss.classList.add('discussion'); const buttonCloseDiscussion: HTMLButtonElement = document.createElement('button'); - this.buttonActiveDiscussion = document.createElement('button'); buttonCloseDiscussion.classList.add('close-btn'); buttonCloseDiscussion.innerHTML = ``; buttonCloseDiscussion.addEventListener('click', () => { this.hideDiscussion(); - this.showButtonDiscussionBtn(); - }); - this.buttonActiveDiscussion.classList.add('active-btn'); - this.buttonActiveDiscussion.innerHTML = ``; - this.buttonActiveDiscussion.addEventListener('click', () => { - this.showDiscussionPart(); }); this.divDiscuss.appendChild(buttonCloseDiscussion); - this.divDiscuss.appendChild(this.buttonActiveDiscussion); const myName: HTMLParagraphElement = document.createElement('p'); myName.innerText = name.toUpperCase(); @@ -128,7 +119,7 @@ export class DiscussionManager { reportBanUserAction.innerText = 'Report'; reportBanUserAction.addEventListener('click', () => { if(reportCallback) { - this.mediaManager.showReportModal(`${userId}`, name ?? '', reportCallback); + mediaManager.showReportModal(`${userId}`, name ?? '', reportCallback); }else{ console.info('report feature is not activated!'); } @@ -139,7 +130,6 @@ export class DiscussionManager { this.divParticipants?.appendChild(divParticipant); this.participants.set(userId, divParticipant); - this.showButtonDiscussionBtn(); this.updateParticipant(this.participants.size); } @@ -184,9 +174,6 @@ export class DiscussionManager { this.participants.delete(userId); } //if all participant leave, hide discussion button - if(this.participants.size === 1){ - this.hideButtonDiscussionBtn(); - } this.sendMessageCallBack.delete(userId); } @@ -199,14 +186,6 @@ export class DiscussionManager { return this.activeDiscussion; } - private showButtonDiscussionBtn(){ - //if it's first participant, show discussion button - if(this.activatedDiscussion || this.participants.size === 1) { - return; - } - this.buttonActiveDiscussion?.classList.add('active'); - } - private showDiscussion(){ this.activeDiscussion = true; if(this.userInputManager) { @@ -222,17 +201,14 @@ export class DiscussionManager { } this.divDiscuss?.classList.remove('active'); } - - private hideButtonDiscussionBtn(){ - this.buttonActiveDiscussion?.classList.remove('active'); - } - + public setUserInputManager(userInputManager : UserInputManager){ this.userInputManager = userInputManager; } public showDiscussionPart(){ this.showDiscussion(); - this.hideButtonDiscussionBtn(); } -} \ No newline at end of file +} + +export const discussionManager = new DiscussionManager(); \ No newline at end of file diff --git a/front/src/WebRtc/MediaManager.ts b/front/src/WebRtc/MediaManager.ts index 7fced45c..4aa240cd 100644 --- a/front/src/WebRtc/MediaManager.ts +++ b/front/src/WebRtc/MediaManager.ts @@ -1,6 +1,6 @@ import {DivImportance, layoutManager} from "./LayoutManager"; import {HtmlUtils} from "./HtmlUtils"; -import {DiscussionManager, SendMessageCallback} from "./DiscussionManager"; +import {discussionManager, SendMessageCallback} from "./DiscussionManager"; import {UserInputManager} from "../Phaser/UserInput/UserInputManager"; import {VIDEO_QUALITY_SELECT} from "../Administration/ConsoleGlobalMessageManager"; declare const navigator:any; // eslint-disable-line @typescript-eslint/no-explicit-any @@ -56,8 +56,6 @@ export class MediaManager { private lastUpdateScene : Date = new Date(); private setTimeOutlastUpdateScene? : NodeJS.Timeout; - private discussionManager: DiscussionManager; - private hasCamera = true; private triggerCloseJistiFrame : Map = new Map(); @@ -120,8 +118,6 @@ export class MediaManager { this.pingCameraStatus(); this.checkActiveUser(); //todo: desactivated in case of bug - - this.discussionManager = new DiscussionManager(this,''); } public setLastUpdateScene(){ @@ -687,11 +683,11 @@ export class MediaManager { } public addNewParticipant(userId: number|string, name: string|undefined, img?: string, reportCallBack?: ReportCallback){ - this.discussionManager.addParticipant(userId, name, img, false, reportCallBack); + discussionManager.addParticipant(userId, name, img, false, reportCallBack); } public removeParticipant(userId: number|string){ - this.discussionManager.removeParticipant(userId); + discussionManager.removeParticipant(userId); } public addTriggerCloseJitsiFrameButton(id: String, Function: Function){ this.triggerCloseJistiFrame.set(id, Function); @@ -718,24 +714,24 @@ export class MediaManager { } public addNewMessage(name: string, message: string, isMe: boolean = false){ - this.discussionManager.addMessage(name, message, isMe); + discussionManager.addMessage(name, message, isMe); //when there are new message, show discussion - if(!this.discussionManager.activatedDiscussion) { - this.discussionManager.showDiscussionPart(); + if(!discussionManager.activatedDiscussion) { + discussionManager.showDiscussionPart(); } } public addSendMessageCallback(userId: string|number, callback: SendMessageCallback){ - this.discussionManager.onSendMessageCallback(userId, callback); + discussionManager.onSendMessageCallback(userId, callback); } get activatedDiscussion(){ - return this.discussionManager.activatedDiscussion; + return discussionManager.activatedDiscussion; } public setUserInputManager(userInputManager : UserInputManager){ - this.discussionManager.setUserInputManager(userInputManager); + discussionManager.setUserInputManager(userInputManager); } //check if user is active private checkActiveUser(){ diff --git a/front/src/index.ts b/front/src/index.ts index 640b04f9..c8783b90 100644 --- a/front/src/index.ts +++ b/front/src/index.ts @@ -13,7 +13,8 @@ import {CustomizeScene} from "./Phaser/Login/CustomizeScene"; import {ResizableScene} from "./Phaser/Login/ResizableScene"; import {EntryScene} from "./Phaser/Login/EntryScene"; import {coWebsiteManager} from "./WebRtc/CoWebsiteManager"; -import {GAME_QUALITY_SELECT} from "./Administration/ConsoleGlobalMessageManager"; +import {MenuScene} from "./Phaser/Menu/MenuScene"; +import {localUserStore} from "./Connexion/LocalUserStore"; // Load Jitsi if the environment variable is set. if (JITSI_URL) { @@ -24,15 +25,7 @@ if (JITSI_URL) { const {width, height} = coWebsiteManager.getGameSize(); -let valueGameQuality : number = 60 -const localGameQuality = localStorage.getItem(GAME_QUALITY_SELECT); -if(localGameQuality){ - try { - valueGameQuality = parseInt(localGameQuality); - }catch (err){ - console.error(err); - } -} +const valueGameQuality = localUserStore.getGameQualityValue(); const fps : Phaser.Types.Core.FPSConfig = { /** * The minimum acceptable rendering rate, in frames per second. @@ -66,9 +59,12 @@ const config: GameConfig = { width: width / RESOLUTION, height: height / RESOLUTION, parent: "game", - scene: [EntryScene, LoginScene, SelectCharacterScene, EnableCameraScene, ReconnectingScene, FourOFourScene, CustomizeScene], + scene: [EntryScene, LoginScene, SelectCharacterScene, EnableCameraScene, ReconnectingScene, FourOFourScene, CustomizeScene, MenuScene], zoom: RESOLUTION, fps: fps, + dom: { + createContainer: true + }, physics: { default: "arcade", arcade: {