diff --git a/front/src/Api/Events/ButtonClickedEvent.ts b/front/src/Api/Events/ButtonClickedEvent.ts index de807037..1343aa0a 100644 --- a/front/src/Api/Events/ButtonClickedEvent.ts +++ b/front/src/Api/Events/ButtonClickedEvent.ts @@ -4,6 +4,8 @@ export const isButtonClickedEvent = new tg.IsInterface().withProperties({ popupId: tg.isNumber, buttonId: tg.isNumber, + input : tg.isBoolean, + inputValue : tg.isString, }).get(); /** * A message sent from the game to the iFrame when a user enters or leaves a zone marked with the "zone" property. diff --git a/front/src/Api/Events/ClosePopupEvent.ts b/front/src/Api/Events/ClosePopupEvent.ts index 83b09c96..db64474b 100644 --- a/front/src/Api/Events/ClosePopupEvent.ts +++ b/front/src/Api/Events/ClosePopupEvent.ts @@ -3,6 +3,7 @@ import * as tg from "generic-type-guard"; export const isClosePopupEvent = new tg.IsInterface().withProperties({ popupId: tg.isNumber, + inputValue : tg.isString, }).get(); /** diff --git a/front/src/Api/Events/OpenPopupEvent.ts b/front/src/Api/Events/OpenPopupEvent.ts index 094ba555..0abcd667 100644 --- a/front/src/Api/Events/OpenPopupEvent.ts +++ b/front/src/Api/Events/OpenPopupEvent.ts @@ -11,7 +11,8 @@ export const isOpenPopupEvent = popupId: tg.isNumber, targetObject: tg.isString, message: tg.isString, - buttons: tg.isArray(isButtonDescriptor) + buttons: tg.isArray(isButtonDescriptor), + input: tg.isBoolean }).get(); /** diff --git a/front/src/Api/IframeListener.ts b/front/src/Api/IframeListener.ts index b0a6781e..8f6da606 100644 --- a/front/src/Api/IframeListener.ts +++ b/front/src/Api/IframeListener.ts @@ -331,12 +331,14 @@ class IframeListener { } } - sendButtonClickedEvent(popupId: number, buttonId: number): void { + sendButtonClickedEvent(popupId: number, buttonId: number, input : boolean, inputValue : string | null): void { this.postMessage({ 'type': 'buttonClickedEvent', 'data': { popupId, - buttonId + buttonId, + input, + inputValue, } as ButtonClickedEvent }); } diff --git a/front/src/Api/iframe/Ui/Popup.ts b/front/src/Api/iframe/Ui/Popup.ts index 37dea922..b4b0240b 100644 --- a/front/src/Api/iframe/Ui/Popup.ts +++ b/front/src/Api/iframe/Ui/Popup.ts @@ -2,7 +2,11 @@ import {sendToWorkadventure} from "../IframeApiContribution"; import type {ClosePopupEvent} from "../../Events/ClosePopupEvent"; export class Popup { + + inputValue: string; + constructor(private id: number) { + this.inputValue = ''; } /** @@ -13,6 +17,7 @@ export class Popup { 'type': 'closePopup', 'data': { 'popupId': this.id, + 'inputValue': this.inputValue, } as ClosePopupEvent }); } diff --git a/front/src/Api/iframe/ui.ts b/front/src/Api/iframe/ui.ts index c7655b84..2aaa98a2 100644 --- a/front/src/Api/iframe/ui.ts +++ b/front/src/Api/iframe/ui.ts @@ -33,6 +33,7 @@ class WorkAdventureUiCommands extends IframeApiContribution void>(); @@ -76,7 +77,8 @@ class WorkAdventureUiCommands extends IframeApiContribution -
+
{#if $statusStore === 'connecting'}
{/if} @@ -33,7 +33,7 @@ {#if $constraintStore && $constraintStore.audio === false} Muted {/if} - diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index c75c830b..06f3b391 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -1,9 +1,9 @@ -import { Queue } from 'queue-typescript'; -import type { Subscription } from "rxjs"; -import { GlobalMessageManager } from "../../Administration/GlobalMessageManager"; -import { userMessageManager } from "../../Administration/UserMessageManager"; -import { iframeListener } from "../../Api/IframeListener"; -import { connectionManager } from "../../Connexion/ConnectionManager"; +import {Queue} from 'queue-typescript'; +import type {Subscription} from "rxjs"; +import {GlobalMessageManager} from "../../Administration/GlobalMessageManager"; +import {userMessageManager} from "../../Administration/UserMessageManager"; +import {iframeListener} from "../../Api/IframeListener"; +import {connectionManager} from "../../Connexion/ConnectionManager"; import type { GroupCreatedUpdatedMessageInterface, MessageUserJoined, @@ -14,25 +14,25 @@ import type { PositionInterface, RoomJoinedMessageInterface } from "../../Connexion/ConnexionModels"; -import { localUserStore } from "../../Connexion/LocalUserStore"; -import { Room } from "../../Connexion/Room"; -import type { RoomConnection } from "../../Connexion/RoomConnection"; -import { worldFullMessageStream } from "../../Connexion/WorldFullMessageStream"; +import {localUserStore} from "../../Connexion/LocalUserStore"; +import {Room} from "../../Connexion/Room"; +import type {RoomConnection} from "../../Connexion/RoomConnection"; +import {worldFullMessageStream} from "../../Connexion/WorldFullMessageStream"; import { DEBUG_MODE, JITSI_PRIVATE_MODE, MAX_PER_GROUP, POSITION_DELAY } from "../../Enum/EnvironmentVariable"; -import { TextureError } from "../../Exception/TextureError"; -import type { UserMovedMessage } from "../../Messages/generated/messages_pb"; -import { ProtobufClientUtils } from "../../Network/ProtobufClientUtils"; -import { touchScreenManager } from "../../Touch/TouchScreenManager"; -import { urlManager } from "../../Url/UrlManager"; -import { audioManager } from "../../WebRtc/AudioManager"; -import { coWebsiteManager } from "../../WebRtc/CoWebsiteManager"; -import { HtmlUtils } from "../../WebRtc/HtmlUtils"; -import { jitsiFactory } from "../../WebRtc/JitsiFactory"; +import {TextureError} from "../../Exception/TextureError"; +import type {UserMovedMessage} from "../../Messages/generated/messages_pb"; +import {ProtobufClientUtils} from "../../Network/ProtobufClientUtils"; +import {touchScreenManager} from "../../Touch/TouchScreenManager"; +import {urlManager} from "../../Url/UrlManager"; +import {audioManager} from "../../WebRtc/AudioManager"; +import {coWebsiteManager} from "../../WebRtc/CoWebsiteManager"; +import {HtmlUtils} from "../../WebRtc/HtmlUtils"; +import {jitsiFactory} from "../../WebRtc/JitsiFactory"; import { AUDIO_LOOP_PROPERTY, AUDIO_VOLUME_PROPERTY, Box, @@ -43,43 +43,44 @@ import { TRIGGER_WEBSITE_PROPERTIES, WEBSITE_MESSAGE_PROPERTIES } from "../../WebRtc/LayoutManager"; -import { mediaManager } from "../../WebRtc/MediaManager"; -import { SimplePeer, UserSimplePeerInterface } from "../../WebRtc/SimplePeer"; -import { lazyLoadCompanionResource } from "../Companion/CompanionTexturesLoadingManager"; -import { ChatModeIcon } from "../Components/ChatModeIcon"; -import { addLoader } from "../Components/Loader"; -import { joystickBaseImg, joystickBaseKey, joystickThumbImg, joystickThumbKey } from "../Components/MobileJoystick"; -import { OpenChatIcon, openChatIconName } from "../Components/OpenChatIcon"; -import { PresentationModeIcon } from "../Components/PresentationModeIcon"; -import { TextUtils } from "../Components/TextUtils"; -import { lazyLoadPlayerCharacterTextures, loadCustomTexture } from "../Entity/PlayerTexturesLoadingManager"; -import { RemotePlayer } from "../Entity/RemotePlayer"; -import type { ActionableItem } from "../Items/ActionableItem"; -import type { ItemFactoryInterface } from "../Items/ItemFactoryInterface"; -import { SelectCharacterScene, SelectCharacterSceneName } from "../Login/SelectCharacterScene"; +import {mediaManager} from "../../WebRtc/MediaManager"; +import {SimplePeer, UserSimplePeerInterface} from "../../WebRtc/SimplePeer"; +import {lazyLoadCompanionResource} from "../Companion/CompanionTexturesLoadingManager"; +import {ChatModeIcon} from "../Components/ChatModeIcon"; +import {addLoader} from "../Components/Loader"; +import {joystickBaseImg, joystickBaseKey, joystickThumbImg, joystickThumbKey} from "../Components/MobileJoystick"; +import {OpenChatIcon, openChatIconName} from "../Components/OpenChatIcon"; +import {PresentationModeIcon} from "../Components/PresentationModeIcon"; +import {TextUtils} from "../Components/TextUtils"; +import {lazyLoadPlayerCharacterTextures, loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager"; +import {RemotePlayer} from "../Entity/RemotePlayer"; +import type {ActionableItem} from "../Items/ActionableItem"; +import type {ItemFactoryInterface} from "../Items/ItemFactoryInterface"; +import {SelectCharacterScene, SelectCharacterSceneName} from "../Login/SelectCharacterScene"; import type { ITiledMap, ITiledMapLayer, ITiledMapLayerProperty, ITiledMapObject, ITiledMapTileLayer, - ITiledTileSet } from "../Map/ITiledMap"; -import { MenuScene, MenuSceneName } from '../Menu/MenuScene'; -import { PlayerAnimationDirections } from "../Player/Animation"; -import { hasMovedEventName, Player, requestEmoteEventName } from "../Player/Player"; -import { ErrorSceneName } from "../Reconnecting/ErrorScene"; -import { ReconnectingSceneName } from "../Reconnecting/ReconnectingScene"; -import { waScaleManager } from "../Services/WaScaleManager"; -import { PinchManager } from "../UserInput/PinchManager"; -import { UserInputManager } from "../UserInput/UserInputManager"; -import type { AddPlayerInterface } from "./AddPlayerInterface"; -import { DEPTH_OVERLAY_INDEX } from "./DepthIndexes"; -import { DirtyScene } from "./DirtyScene"; -import { EmoteManager } from "./EmoteManager"; -import { gameManager } from "./GameManager"; -import { GameMap } from "./GameMap"; -import { PlayerMovement } from "./PlayerMovement"; -import { PlayersPositionInterpolator } from "./PlayersPositionInterpolator"; + ITiledTileSet +} from "../Map/ITiledMap"; +import {MenuScene, MenuSceneName} from '../Menu/MenuScene'; +import {PlayerAnimationDirections} from "../Player/Animation"; +import {hasMovedEventName, Player, requestEmoteEventName} from "../Player/Player"; +import {ErrorSceneName} from "../Reconnecting/ErrorScene"; +import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene"; +import {waScaleManager} from "../Services/WaScaleManager"; +import {PinchManager} from "../UserInput/PinchManager"; +import {UserInputManager} from "../UserInput/UserInputManager"; +import type {AddPlayerInterface} from "./AddPlayerInterface"; +import {DEPTH_OVERLAY_INDEX} from "./DepthIndexes"; +import {DirtyScene} from "./DirtyScene"; +import {EmoteManager} from "./EmoteManager"; +import {gameManager} from "./GameManager"; +import {GameMap} from "./GameMap"; +import {PlayerMovement} from "./PlayerMovement"; +import {PlayersPositionInterpolator} from "./PlayersPositionInterpolator"; import Texture = Phaser.Textures.Texture; import Sprite = Phaser.GameObjects.Sprite; import CanvasTexture = Phaser.Textures.CanvasTexture; @@ -89,7 +90,7 @@ import DOMElement = Phaser.GameObjects.DOMElement; import EVENT_TYPE = Phaser.Scenes.Events import RenderTexture = Phaser.GameObjects.RenderTexture; import Tilemap = Phaser.Tilemaps.Tilemap; -import type { HasPlayerMovedEvent } from '../../Api/Events/HasPlayerMovedEvent'; +import type {HasPlayerMovedEvent} from '../../Api/Events/HasPlayerMovedEvent'; import AnimatedTiles from "phaser-animated-tiles"; import {soundManager} from "./SoundManager"; @@ -217,14 +218,14 @@ export class GameScene extends DirtyScene { preload(): void { const localUser = localUserStore.getLocalUser(); const textures = localUser?.textures; - if (textures) { - for (const texture of textures) { + if(textures) { + for(const texture of textures) { loadCustomTexture(this.load, texture); } } this.load.image(openChatIconName, 'resources/objects/talk.png'); - if (touchScreenManager.supportTouchScreen) { + if(touchScreenManager.supportTouchScreen) { this.load.image(joystickBaseKey, joystickBaseImg); this.load.image(joystickThumbKey, joystickThumbImg); } @@ -233,9 +234,9 @@ export class GameScene extends DirtyScene { //this.load.audio('audio-report-message', '/resources/objects/report-message.mp3'); this.sound.pauseOnBlur = false; - this.load.on(FILE_LOAD_ERROR, (file: { src: string }) => { + this.load.on(FILE_LOAD_ERROR, (file: {src: string}) => { // If we happen to be in HTTP and we are trying to load a URL in HTTPS only... (this happens only in dev environments) - if (window.location.protocol === 'http:' && file.src === this.MapUrlFile && file.src.startsWith('http:') && this.originalMapUrl === undefined) { + if(window.location.protocol === 'http:' && file.src === this.MapUrlFile && file.src.startsWith('http:') && this.originalMapUrl === undefined) { this.originalMapUrl = this.MapUrlFile; this.MapUrlFile = this.MapUrlFile.replace('http://', 'https://'); this.load.tilemapTiledJSON(this.MapUrlFile, this.MapUrlFile); @@ -249,7 +250,7 @@ export class GameScene extends DirtyScene { // See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#when_is_a_context_considered_secure const url = new URL(file.src); const host = url.host.split(':')[0]; - if (window.location.protocol === 'https:' && file.src === this.MapUrlFile && (host === '127.0.0.1' || host === 'localhost' || host.endsWith('.localhost')) && this.originalMapUrl === undefined) { + if(window.location.protocol === 'https:' && file.src === this.MapUrlFile && (host === '127.0.0.1' || host === 'localhost' || host.endsWith('.localhost')) && this.originalMapUrl === undefined) { this.originalMapUrl = this.MapUrlFile; this.MapUrlFile = this.MapUrlFile.replace('https://', 'http://'); this.load.tilemapTiledJSON(this.MapUrlFile, this.MapUrlFile); @@ -273,7 +274,7 @@ export class GameScene extends DirtyScene { this.load.tilemapTiledJSON(this.MapUrlFile, this.MapUrlFile); // If the map has already been loaded as part of another GameScene, the "on load" event will not be triggered. // In this case, we check in the cache to see if the map is here and trigger the event manually. - if (this.cache.tilemap.exists(this.MapUrlFile)) { + if(this.cache.tilemap.exists(this.MapUrlFile)) { const data = this.cache.tilemap.get(this.MapUrlFile); this.onMapLoad(data); } @@ -300,7 +301,7 @@ export class GameScene extends DirtyScene { this.mapFile = data.data; const url = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/')); this.mapFile.tilesets.forEach((tileset) => { - if (typeof tileset.name === 'undefined' || typeof tileset.image === 'undefined') { + if(typeof tileset.name === 'undefined' || typeof tileset.image === 'undefined') { console.warn("Don't know how to handle tileset ", tileset) return; } @@ -311,15 +312,15 @@ export class GameScene extends DirtyScene { // Scan the object layers for objects to load and load them. const objects = new Map(); - for (const layer of this.mapFile.layers) { - if (layer.type === 'objectgroup') { - for (const object of layer.objects) { + for(const layer of this.mapFile.layers) { + if(layer.type === 'objectgroup') { + for(const object of layer.objects) { let objectsOfType: ITiledMapObject[] | undefined; - if (!objects.has(object.type)) { + if(!objects.has(object.type)) { objectsOfType = new Array(); } else { objectsOfType = objects.get(object.type); - if (objectsOfType === undefined) { + if(objectsOfType === undefined) { throw new Error('Unexpected object type not found'); } } @@ -329,12 +330,12 @@ export class GameScene extends DirtyScene { } } - for (const [itemType, objectsOfType] of objects) { + for(const [itemType, objectsOfType] of objects) { // FIXME: we would ideally need for the loader to WAIT for the import to be performed, which means writing our own loader plugin. let itemFactory: ItemFactoryInterface; - switch (itemType) { + switch(itemType) { case 'computer': { const module = await import('../Items/Computer/computer'); itemFactory = module.default; @@ -356,7 +357,7 @@ export class GameScene extends DirtyScene { const roomJoinedAnswer = await this.connectionAnswerPromise; - for (const object of objectsOfType) { + for(const object of objectsOfType) { // TODO: we should pass here a factory to create sprites (maybe?) // Do we have a state for this object? @@ -371,17 +372,17 @@ export class GameScene extends DirtyScene { // Now, let's load the script, if any const scripts = this.getScriptUrls(this.mapFile); - for (const script of scripts) { + for(const script of scripts) { iframeListener.registerScript(script); } } //hook initialisation init(initData: GameSceneInitInterface) { - if (initData.initPosition !== undefined) { + if(initData.initPosition !== undefined) { this.initPosition = initData.initPosition; //todo: still used? } - if (initData.initPosition !== undefined) { + if(initData.initPosition !== undefined) { this.isReconnecting = initData.reconnecting; } } @@ -394,14 +395,14 @@ export class GameScene extends DirtyScene { urlManager.pushRoomIdToUrl(this.room); this.startLayerName = urlManager.getStartLayerNameFromUrl(); - if (touchScreenManager.supportTouchScreen) { + if(touchScreenManager.supportTouchScreen) { this.pinchManager = new PinchManager(this); } this.messageSubscription = worldFullMessageStream.stream.subscribe((message) => this.showWorldFullError(message)) const playerName = gameManager.getPlayerName(); - if (!playerName) { + if(!playerName) { throw 'playerName is not set'; } this.playerName = playerName; @@ -420,21 +421,21 @@ export class GameScene extends DirtyScene { //add layer on map this.gameMap = new GameMap(this.mapFile, this.Map, this.Terrains); - for (const layer of this.gameMap.flatLayers) { - if (layer.type === 'tilelayer') { + for(const layer of this.gameMap.flatLayers) { + if(layer.type === 'tilelayer') { const exitSceneUrl = this.getExitSceneUrl(layer); - if (exitSceneUrl !== undefined) { + if(exitSceneUrl !== undefined) { this.loadNextGame(exitSceneUrl); } const exitUrl = this.getExitUrl(layer); - if (exitUrl !== undefined) { + if(exitUrl !== undefined) { this.loadNextGame(exitUrl); } } - if (layer.type === 'objectgroup') { - for (const object of layer.objects) { - if (object.text) { + if(layer.type === 'objectgroup') { + for(const object of layer.objects) { + if(object.text) { TextUtils.createTextFromITiledMapObject(this, object); } } @@ -451,14 +452,14 @@ export class GameScene extends DirtyScene { this.Objects = new Array(); //initialise list of other player - this.MapPlayers = this.physics.add.group({ immovable: true }); + this.MapPlayers = this.physics.add.group({immovable: true}); //create input to move this.userInputManager = new UserInputManager(this); mediaManager.setUserInputManager(this.userInputManager); - if (localUserStore.getFullscreen()) { + if(localUserStore.getFullscreen()) { document.querySelector('body')?.requestFullscreen(); } @@ -474,16 +475,16 @@ export class GameScene extends DirtyScene { this.initCirclesCanvas(); // Let's pause the scene if the connection is not established yet - if (!this.room.isDisconnected()) { - if (this.isReconnecting) { + if(!this.room.isDisconnected()) { + if(this.isReconnecting) { setTimeout(() => { this.scene.sleep(); this.scene.launch(ReconnectingSceneName); }, 0); - } else if (this.connection === undefined) { + } else if(this.connection === undefined) { // Let's wait 1 second before printing the "connecting" screen to avoid blinking setTimeout(() => { - if (this.connection === undefined) { + if(this.connection === undefined) { this.scene.sleep(); this.scene.launch(ReconnectingSceneName); } @@ -508,7 +509,7 @@ export class GameScene extends DirtyScene { this.listenToIframeEvents(); - if (!this.room.isDisconnected()) { + if(!this.room.isDisconnected()) { this.connect(); } @@ -517,11 +518,11 @@ export class GameScene extends DirtyScene { let oldPeerNumber = 0; this.peerStoreUnsubscribe = peerStore.subscribe((peers) => { const newPeerNumber = peers.size; - if (newPeerNumber > oldPeerNumber) { + if(newPeerNumber > oldPeerNumber) { this.sound.play('audio-webrtc-in', { volume: 0.2 }); - } else if (newPeerNumber < oldPeerNumber) { + } else if(newPeerNumber < oldPeerNumber) { this.sound.play('audio-webrtc-out', { volume: 0.2 }); @@ -568,7 +569,7 @@ export class GameScene extends DirtyScene { this.connection.onUserMoved((message: UserMovedMessage) => { const position = message.getPosition(); - if (position === undefined) { + if(position === undefined) { throw new Error('Position missing from UserMovedMessage'); } @@ -591,7 +592,7 @@ export class GameScene extends DirtyScene { this.connection.onGroupDeleted((groupId: number) => { try { this.deleteGroup(groupId); - } catch (e) { + } catch(e) { console.error(e); } }) @@ -617,7 +618,7 @@ export class GameScene extends DirtyScene { this.connection.onActionableEvent((message => { const item = this.actionableItems.get(message.itemId); - if (item === undefined) { + if(item === undefined) { console.warn('Received an event about object "' + message.itemId + '" but cannot find this item on the map.'); return; } @@ -646,7 +647,7 @@ export class GameScene extends DirtyScene { audioManager.decreaseVolume(); }, onDisconnect(userId: number) { - if (self.simplePeer.getNbConnections() === 0) { + if(self.simplePeer.getNbConnections() === 0) { self.openChatIcon.setVisible(false); audioManager.restoreVolume(); } @@ -677,12 +678,12 @@ export class GameScene extends DirtyScene { private initCirclesCanvas(): void { // Let's generate the circle for the group delimiter let circleElement = Object.values(this.textures.list).find((object: Texture) => object.key === 'circleSprite-white'); - if (circleElement) { + if(circleElement) { this.textures.remove('circleSprite-white'); } circleElement = Object.values(this.textures.list).find((object: Texture) => object.key === 'circleSprite-red'); - if (circleElement) { + if(circleElement) { this.textures.remove('circleSprite-red'); } @@ -711,7 +712,7 @@ export class GameScene extends DirtyScene { private safeParseJSONstring(jsonString: string | undefined, propertyName: string) { try { return jsonString ? JSON.parse(jsonString) : {}; - } catch (e) { + } catch(e) { console.warn('Invalid JSON found in property "' + propertyName + '" of the map:' + jsonString, e); return {} } @@ -719,13 +720,13 @@ export class GameScene extends DirtyScene { private triggerOnMapLayerPropertyChange() { this.gameMap.onPropertyChange('exitSceneUrl', (newValue, oldValue) => { - if (newValue) this.onMapExit(newValue as string); + if(newValue) this.onMapExit(newValue as string); }); this.gameMap.onPropertyChange('exitUrl', (newValue, oldValue) => { - if (newValue) this.onMapExit(newValue as string); + if(newValue) this.onMapExit(newValue as string); }); this.gameMap.onPropertyChange('openWebsite', (newValue, oldValue, allProps) => { - if (newValue === undefined) { + if(newValue === undefined) { layoutManager.removeActionButton('openWebsite', this.userInputManager); coWebsiteManager.closeCoWebsite(); } else { @@ -735,9 +736,9 @@ export class GameScene extends DirtyScene { }; const openWebsiteTriggerValue = allProps.get(TRIGGER_WEBSITE_PROPERTIES); - if (openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) { + if(openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) { let message = allProps.get(WEBSITE_MESSAGE_PROPERTIES); - if (message === undefined) { + if(message === undefined) { message = 'Press SPACE or touch here to open web site'; } layoutManager.addActionButton('openWebsite', message.toString(), () => { @@ -749,14 +750,14 @@ export class GameScene extends DirtyScene { } }); this.gameMap.onPropertyChange('jitsiRoom', (newValue, oldValue, allProps) => { - if (newValue === undefined) { + if(newValue === undefined) { layoutManager.removeActionButton('jitsiRoom', this.userInputManager); this.stopJitsi(); } else { const openJitsiRoomFunction = () => { const roomName = jitsiFactory.getRoomName(newValue.toString(), this.instance); const jitsiUrl = allProps.get("jitsiUrl") as string | undefined; - if (JITSI_PRIVATE_MODE && !jitsiUrl) { + if(JITSI_PRIVATE_MODE && !jitsiUrl) { const adminTag = allProps.get("jitsiRoomAdminTag") as string | undefined; this.connection?.emitQueryJitsiJwtMessage(roomName, adminTag); @@ -767,9 +768,9 @@ export class GameScene extends DirtyScene { } const jitsiTriggerValue = allProps.get(TRIGGER_JITSI_PROPERTIES); - if (jitsiTriggerValue && jitsiTriggerValue === ON_ACTION_TRIGGER_BUTTON) { + if(jitsiTriggerValue && jitsiTriggerValue === ON_ACTION_TRIGGER_BUTTON) { let message = allProps.get(JITSI_MESSAGE_PROPERTIES); - if (message === undefined) { + if(message === undefined) { message = 'Press SPACE or touch here to enter Jitsi Meet room'; } layoutManager.addActionButton('jitsiRoom', message.toString(), () => { @@ -781,7 +782,7 @@ export class GameScene extends DirtyScene { } }); this.gameMap.onPropertyChange('silent', (newValue, oldValue) => { - if (newValue === undefined || newValue === false || newValue === '') { + if(newValue === undefined || newValue === false || newValue === '') { this.connection?.setSilent(false); } else { this.connection?.setSilent(true); @@ -798,7 +799,7 @@ export class GameScene extends DirtyScene { }); this.gameMap.onPropertyChange('zone', (newValue, oldValue) => { - if (newValue === undefined || newValue === false || newValue === '') { + if(newValue === undefined || newValue === false || newValue === '') { iframeListener.sendLeaveEvent(oldValue as string); } else { @@ -813,20 +814,23 @@ export class GameScene extends DirtyScene { let objectLayerSquare: ITiledMapObject; const targetObjectData = this.getObjectLayerData(openPopupEvent.targetObject); - if (targetObjectData !== undefined) { + if(targetObjectData !== undefined) { objectLayerSquare = targetObjectData; } else { console.error("Error while opening a popup. Cannot find an object on the map with name '" + openPopupEvent.targetObject + "'. The first parameter of WA.openPopup() must be the name of a rectangle object in your map."); return; } const escapedMessage = HtmlUtils.escapeHtml(openPopupEvent.message); - let html = `