diff --git a/front/src/Api/Events/ButtonClickedEvent.ts b/front/src/Api/Events/ButtonClickedEvent.ts index 02bb0c8e..0ffb41c6 100644 --- a/front/src/Api/Events/ButtonClickedEvent.ts +++ b/front/src/Api/Events/ButtonClickedEvent.ts @@ -6,7 +6,8 @@ export const isButtonClickedEvent = new tg.IsInterface() buttonId: tg.isNumber, input: tg.isBoolean, inputValue: tg.isString, - }).get(); + }) + .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 03af8e21..087b868c 100644 --- a/front/src/Api/Events/ClosePopupEvent.ts +++ b/front/src/Api/Events/ClosePopupEvent.ts @@ -4,7 +4,8 @@ export const isClosePopupEvent = new tg.IsInterface() .withProperties({ popupId: tg.isNumber, inputValue: tg.isString, - }).get(); + }) + .get(); /** * A message sent from the iFrame to the game to add a message in the chat. diff --git a/front/src/Api/Events/OpenPopupEvent.ts b/front/src/Api/Events/OpenPopupEvent.ts index 7d7556fb..c9fe74d7 100644 --- a/front/src/Api/Events/OpenPopupEvent.ts +++ b/front/src/Api/Events/OpenPopupEvent.ts @@ -13,9 +13,10 @@ export const isOpenPopupEvent = new tg.IsInterface() targetObject: tg.isString, message: tg.isString, buttons: tg.isArray(isButtonDescriptor), - popupClass : tg.isString, - input: tg.isBoolean - }).get(); + popupClass: tg.isString, + input: tg.isBoolean, + }) + .get(); /** * A message sent from the iFrame to the game to add a message in the chat. diff --git a/front/src/Api/IframeListener.ts b/front/src/Api/IframeListener.ts index 438f1d10..f846e52f 100644 --- a/front/src/Api/IframeListener.ts +++ b/front/src/Api/IframeListener.ts @@ -283,7 +283,7 @@ class IframeListener { unregisterIframe(iframe: HTMLIFrameElement): void { this._unregisterIFrameStream.next(); - this.iframeCloseCallbacks.get(iframe)?.forEach(callback => { + this.iframeCloseCallbacks.get(iframe)?.forEach((callback) => { callback(); }); this.iframes.delete(iframe); @@ -478,7 +478,7 @@ class IframeListener { }); } - sendButtonClickedEvent(popupId: number, buttonId: number, input : boolean, inputValue : string | null): void { + sendButtonClickedEvent(popupId: number, buttonId: number, input: boolean, inputValue: string | null): void { this.postMessage({ type: "buttonClickedEvent", data: { @@ -486,7 +486,7 @@ class IframeListener { buttonId, input, inputValue, - } as ButtonClickedEvent + } as ButtonClickedEvent, }); } diff --git a/front/src/Api/iframe/Ui/Popup.ts b/front/src/Api/iframe/Ui/Popup.ts index 9bc8b2ad..a96e41df 100644 --- a/front/src/Api/iframe/Ui/Popup.ts +++ b/front/src/Api/iframe/Ui/Popup.ts @@ -2,11 +2,10 @@ import { sendToWorkadventure } from "../IframeApiContribution"; import type { ClosePopupEvent } from "../../Events/ClosePopupEvent"; export class Popup { - inputValue: string; constructor(private id: number) { - this.inputValue = ''; + this.inputValue = ""; } /** @@ -14,11 +13,11 @@ export class Popup { */ public close(): void { sendToWorkadventure({ - 'type': 'closePopup', - 'data': { - 'popupId': this.id, - 'inputValue': this.inputValue, - } as ClosePopupEvent + type: "closePopup", + data: { + popupId: this.id, + inputValue: this.inputValue, + } as ClosePopupEvent, }); } } diff --git a/front/src/Api/iframe/room.ts b/front/src/Api/iframe/room.ts index 60efc5b6..fe02b5e4 100644 --- a/front/src/Api/iframe/room.ts +++ b/front/src/Api/iframe/room.ts @@ -131,12 +131,13 @@ export class WorkadventureRoomCommands extends IframeApiContribution { - const event = await queryWorkadventure({ - type: "getProperty", data: { + const event = await queryWorkadventure({ + type: "getProperty", + data: { layerName: layerName, propertyName: propertyName, - propertyValue : undefined, - } + propertyValue: undefined, + }, }); return event.propertyValue; } diff --git a/front/src/Api/iframe/ui.ts b/front/src/Api/iframe/ui.ts index 87301f68..64849af0 100644 --- a/front/src/Api/iframe/ui.ts +++ b/front/src/Api/iframe/ui.ts @@ -85,7 +85,13 @@ export class WorkAdventureUiCommands extends IframeApiContribution void>(); @@ -114,7 +120,7 @@ export class WorkAdventureUiCommands extends IframeApiContribution { return res.data; - } - ); + }); return worlds; } diff --git a/front/src/Connexion/Room.ts b/front/src/Connexion/Room.ts index df9f7060..53f46b10 100644 --- a/front/src/Connexion/Room.ts +++ b/front/src/Connexion/Room.ts @@ -167,7 +167,7 @@ export class Room { //const match = /@\/([^/]+)\/([^/]+)\/.+/.exec(this.id); //if (!match) throw new Error('Could not extract instance from "' + this.id + '"'); //this.instance = match[1] + "/" + match[2]; - this.instance = "" + this.instance = ""; return this.instance; } } diff --git a/front/src/Connexion/World.ts b/front/src/Connexion/World.ts index 773ddb6a..b6e905ae 100644 --- a/front/src/Connexion/World.ts +++ b/front/src/Connexion/World.ts @@ -1,4 +1,4 @@ export interface World { - roomId: string; - player: string[]; + roomId: string; + player: string[]; } diff --git a/front/src/Phaser/Entity/PlayerTextures.ts b/front/src/Phaser/Entity/PlayerTextures.ts index 740835ff..8468a899 100644 --- a/front/src/Phaser/Entity/PlayerTextures.ts +++ b/front/src/Phaser/Entity/PlayerTextures.ts @@ -182,7 +182,7 @@ export const HAIR_RESOURCES: BodyResourceDescriptionListInterface = { hair_72: { name: "hair_72", img: "resources/customisation/character_hairs/character_hairs71.png" }, hair_73: { name: "hair_73", img: "resources/customisation/character_hairs/character_hairs72.png" }, hair_74: { name: "hair_74", img: "resources/customisation/character_hairs/character_hairs73.png" }, - hair_75: { name: "hair_75", img: "resources/customisation/character_hairs/character_hairs74.png" } + hair_75: { name: "hair_75", img: "resources/customisation/character_hairs/character_hairs74.png" }, }; export const CLOTHES_RESOURCES: BodyResourceDescriptionListInterface = { @@ -435,8 +435,8 @@ export const ACCESSORIES_RESOURCES: BodyResourceDescriptionListInterface = { img: "resources/customisation/character_accessories/mate_bottle1.png", }, accessory_mask: { name: "accessory_mask", img: "resources/customisation/character_accessories/mask.png" }, - wheelchair: { - name: "accessory_wheelchair", + wheelchair: { + name: "accessory_wheelchair", img: "resources/customisation/character_accessories/wheelchair.png", }, }; diff --git a/front/src/Phaser/Game/GameMap.ts b/front/src/Phaser/Game/GameMap.ts index 42abd839..b29c217d 100644 --- a/front/src/Phaser/Game/GameMap.ts +++ b/front/src/Phaser/Game/GameMap.ts @@ -255,10 +255,7 @@ export class GameMap { } } - public getLayerProperty( - layerName: string, - propertyName: string - ) : string | number | undefined | boolean { + public getLayerProperty(layerName: string, propertyName: string): string | number | undefined | boolean { const layer = this.findLayer(layerName); if (layer === undefined) { console.warn('Could not find layer "' + layerName + '" when calling setProperty'); diff --git a/front/src/Phaser/Game/GameMapPropertiesListener.ts b/front/src/Phaser/Game/GameMapPropertiesListener.ts index 2c7300e3..22a426d5 100644 --- a/front/src/Phaser/Game/GameMapPropertiesListener.ts +++ b/front/src/Phaser/Game/GameMapPropertiesListener.ts @@ -161,17 +161,26 @@ export class GameMapPropertiesListener { callback: () => openWebsiteFunction(), userInputManager: this.scene.userInputManager, }); - } + }; - this.coWebsitesIframeListeners.set(layer, iframeListener.unregisterIFrameStream.subscribe(() => { - const coWebsiteOpen = this.coWebsitesOpenByLayer.get(layer); - if (coWebsiteOpen?.coWebsite?.state == CoWebsiteState.CLOSED && (!websiteTriggerProperty || websiteTriggerProperty !== ON_ACTION_TRIGGER_DISABLE)) { - createWebsiteTrigger(); - } - })); + this.coWebsitesIframeListeners.set( + layer, + iframeListener.unregisterIFrameStream.subscribe(() => { + const coWebsiteOpen = this.coWebsitesOpenByLayer.get(layer); + if ( + coWebsiteOpen?.coWebsite?.state == CoWebsiteState.CLOSED && + (!websiteTriggerProperty || websiteTriggerProperty !== ON_ACTION_TRIGGER_DISABLE) + ) { + createWebsiteTrigger(); + } + }) + ); const forceTrigger = localUserStore.getForceCowebsiteTrigger(); - if (forceTrigger || websiteTriggerProperty && websiteTriggerProperty === ON_ACTION_TRIGGER_BUTTON) { + if ( + forceTrigger || + (websiteTriggerProperty && websiteTriggerProperty === ON_ACTION_TRIGGER_BUTTON) + ) { createWebsiteTrigger(); } else { this.coWebsitesOpenByLayer.set(layer, { @@ -215,7 +224,6 @@ export class GameMapPropertiesListener { const coWebsiteIframeListener = this.coWebsitesIframeListeners.get(layer); - if (coWebsiteIframeListener) { coWebsiteIframeListener.unsubscribe(); this.coWebsitesIframeListeners.delete(layer); @@ -232,7 +240,10 @@ export class GameMapPropertiesListener { return; } - if (coWebsiteOpen.state !== OpenCoWebsiteState.OPENED && coWebsiteOpen.state !== OpenCoWebsiteState.TRIGGER) { + if ( + coWebsiteOpen.state !== OpenCoWebsiteState.OPENED && + coWebsiteOpen.state !== OpenCoWebsiteState.TRIGGER + ) { return; } diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index a6388262..9c6fa2e9 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -282,7 +282,7 @@ export class GameScene extends DirtyScene { const base = new URL(window.location.href); base.pathname = ""; const url = new URL(file.src, base.toString()); - const host = url.host.split(":")[ 0 ]; + const host = url.host.split(":")[0]; if ( window.location.protocol === "https:" && file.src === this.MapUrlFile && @@ -337,8 +337,8 @@ export class GameScene extends DirtyScene { //eslint-disable-next-line @typescript-eslint/no-explicit-any (this.load as any).rexWebFont({ custom: { - families: [ "Press Start 2P" ], - urls: [ "/resources/fonts/fonts.css" ], + families: ["Press Start 2P"], + urls: ["/resources/fonts/fonts.css"], testString: "abcdefg", }, }); @@ -387,7 +387,7 @@ export class GameScene extends DirtyScene { } } - for (const [ itemType, objectsOfType ] of this.objectsByType) { + for (const [itemType, objectsOfType] of this.objectsByType) { // 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; @@ -787,8 +787,8 @@ export class GameScene extends DirtyScene { if (item === undefined) { console.warn( 'Received an event about object "' + - message.itemId + - '" but cannot find this item on the map.' + message.itemId + + '" but cannot find this item on the map.' ); return; } @@ -1061,8 +1061,8 @@ export class GameScene extends DirtyScene { } 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." + openPopupEvent.targetObject + + "'. The first parameter of WA.openPopup() must be the name of a rectangle object in your map." ); return; } @@ -1070,7 +1070,7 @@ export class GameScene extends DirtyScene { let html = `