prettier
This commit is contained in:
parent
31f6847b53
commit
e3b58a0d56
@ -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.
|
||||
*/
|
||||
|
@ -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.
|
||||
|
@ -14,8 +14,9 @@ export const isOpenPopupEvent = new tg.IsInterface()
|
||||
message: tg.isString,
|
||||
buttons: tg.isArray(isButtonDescriptor),
|
||||
popupClass: tg.isString,
|
||||
input: tg.isBoolean
|
||||
}).get();
|
||||
input: tg.isBoolean,
|
||||
})
|
||||
.get();
|
||||
|
||||
/**
|
||||
* A message sent from the iFrame to the game to add a message in the chat.
|
||||
|
@ -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);
|
||||
@ -486,7 +486,7 @@ class IframeListener {
|
||||
buttonId,
|
||||
input,
|
||||
inputValue,
|
||||
} as ButtonClickedEvent
|
||||
} as ButtonClickedEvent,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -132,11 +132,12 @@ export class WorkadventureRoomCommands extends IframeApiContribution<Workadventu
|
||||
|
||||
async getProperty(layerName: string, propertyName: string): Promise<string | number | boolean | undefined> {
|
||||
const event = await queryWorkadventure({
|
||||
type: "getProperty", data: {
|
||||
type: "getProperty",
|
||||
data: {
|
||||
layerName: layerName,
|
||||
propertyName: propertyName,
|
||||
propertyValue: undefined,
|
||||
}
|
||||
},
|
||||
});
|
||||
return event.propertyValue;
|
||||
}
|
||||
|
@ -85,7 +85,13 @@ export class WorkAdventureUiCommands extends IframeApiContribution<WorkAdventure
|
||||
}),
|
||||
];
|
||||
|
||||
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[], popupClass : string = "", input: boolean = false): Popup {
|
||||
openPopup(
|
||||
targetObject: string,
|
||||
message: string,
|
||||
buttons: ButtonDescriptor[],
|
||||
popupClass: string = "",
|
||||
input: boolean = false
|
||||
): Popup {
|
||||
popupId++;
|
||||
const popup = new Popup(popupId);
|
||||
const btnMap = new Map<number, () => void>();
|
||||
@ -114,7 +120,7 @@ export class WorkAdventureUiCommands extends IframeApiContribution<WorkAdventure
|
||||
};
|
||||
}),
|
||||
popupClass,
|
||||
input
|
||||
input,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -360,7 +360,6 @@ class ConnectionManager {
|
||||
}
|
||||
|
||||
async getWorlds() {
|
||||
|
||||
const token = localUserStore.getAuthToken();
|
||||
if (!token) {
|
||||
throw new Error("No token provided");
|
||||
@ -368,8 +367,7 @@ class ConnectionManager {
|
||||
|
||||
const { worlds } = await Axios.get(`${PUSHER_URL}/worlds`, { params: { token } }).then((res) => {
|
||||
return res.data;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return worlds;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 = {
|
||||
|
@ -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');
|
||||
|
@ -161,17 +161,26 @@ export class GameMapPropertiesListener {
|
||||
callback: () => openWebsiteFunction(),
|
||||
userInputManager: this.scene.userInputManager,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.coWebsitesIframeListeners.set(layer, iframeListener.unregisterIFrameStream.subscribe(() => {
|
||||
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)) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1070,7 +1070,7 @@ export class GameScene extends DirtyScene {
|
||||
let html = `<div id="container" hidden><div class="nes-container with-title is-centered">`;
|
||||
html += escapedMessage;
|
||||
if (openPopupEvent.input) {
|
||||
html += `<input id="popupinput-${openPopupEvent.popupId}" class="nes-input" />`
|
||||
html += `<input id="popupinput-${openPopupEvent.popupId}" class="nes-input" />`;
|
||||
}
|
||||
html += `</div>`;
|
||||
|
||||
@ -1102,11 +1102,18 @@ export class GameScene extends DirtyScene {
|
||||
);
|
||||
const btnId = id;
|
||||
button.onclick = () => {
|
||||
let inputValue = '';
|
||||
let inputValue = "";
|
||||
if (openPopupEvent.input) {
|
||||
inputValue = HtmlUtils.getElementByIdOrFail<HTMLInputElement>(`popupinput-${openPopupEvent.popupId}`).value;
|
||||
inputValue = HtmlUtils.getElementByIdOrFail<HTMLInputElement>(
|
||||
`popupinput-${openPopupEvent.popupId}`
|
||||
).value;
|
||||
}
|
||||
iframeListener.sendButtonClickedEvent(openPopupEvent.popupId, btnId, openPopupEvent.input, inputValue);
|
||||
iframeListener.sendButtonClickedEvent(
|
||||
openPopupEvent.popupId,
|
||||
btnId,
|
||||
openPopupEvent.input,
|
||||
inputValue
|
||||
);
|
||||
// Disable for a short amount of time to let time to the script to remove the popup
|
||||
button.disabled = true;
|
||||
setTimeout(() => {
|
||||
@ -1370,11 +1377,13 @@ export class GameScene extends DirtyScene {
|
||||
})
|
||||
);
|
||||
|
||||
this.iframeSubscriptionList.push(iframeListener.setTilesStream.subscribe((eventTiles) => {
|
||||
this.iframeSubscriptionList.push(
|
||||
iframeListener.setTilesStream.subscribe((eventTiles) => {
|
||||
for (const eventTile of eventTiles) {
|
||||
this.gameMap.putTile(eventTile.tile, eventTile.x, eventTile.y, eventTile.layer);
|
||||
}
|
||||
}))
|
||||
})
|
||||
);
|
||||
|
||||
iframeListener.registerAnswerer("loadTileset", (eventTileset) => {
|
||||
return this.connectionAnswerPromise.then(() => {
|
||||
@ -2191,7 +2200,10 @@ export class GameScene extends DirtyScene {
|
||||
layoutManagerActionStore.removeAction("jitsi");
|
||||
} else {
|
||||
const openJitsiRoomFunction = () => {
|
||||
const roomName = jitsiFactory.getRoomName(allProps.get(GameMapProperties.JITSI_ROOM) as string, this.instance);
|
||||
const roomName = jitsiFactory.getRoomName(
|
||||
allProps.get(GameMapProperties.JITSI_ROOM) as string,
|
||||
this.instance
|
||||
);
|
||||
const jitsiUrl = allProps.get(GameMapProperties.JITSI_URL) as string | undefined;
|
||||
if (JITSI_PRIVATE_MODE && !jitsiUrl) {
|
||||
const adminTag = allProps.get(GameMapProperties.JITSI_ADMIN_ROOM_TAG) as string | undefined;
|
||||
@ -2201,7 +2213,7 @@ export class GameScene extends DirtyScene {
|
||||
this.startJitsi(roomName, undefined);
|
||||
}
|
||||
layoutManagerActionStore.removeAction("jitsi");
|
||||
}
|
||||
};
|
||||
|
||||
let message = allProps.get(GameMapProperties.JITSI_TRIGGER_MESSAGE);
|
||||
if (message === undefined) {
|
||||
|
@ -53,15 +53,14 @@ export class StartPositionCalculator {
|
||||
selectedOrDefaultLayer = defaultStartLayerName;
|
||||
}
|
||||
|
||||
selectedOrDefaultLayer = selectedOrDefaultLayer.replace('#','');
|
||||
selectedOrDefaultLayer = selectedOrDefaultLayer.replace("#", "");
|
||||
|
||||
let foundLayer: ITiledMapLayer | null = null;
|
||||
for (const layer of this.gameMap.flatLayers) {
|
||||
if (layer.type !== "tilelayer") continue;
|
||||
//we want to prioritize the selectedLayer other the start layer
|
||||
if (
|
||||
(selectedOrDefaultLayer === layer.name ||
|
||||
layer.name.endsWith("/" + selectedOrDefaultLayer)) &&
|
||||
(selectedOrDefaultLayer === layer.name || layer.name.endsWith("/" + selectedOrDefaultLayer)) &&
|
||||
layer.type === "tilelayer" &&
|
||||
(selectedOrDefaultLayer === defaultStartLayerName || this.isStartLayer(layer))
|
||||
) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const sanitizeHtml = require('sanitize-html');
|
||||
const sanitizeHtml = require("sanitize-html");
|
||||
|
||||
export class HtmlUtils {
|
||||
public static getElementByIdOrFail<T extends HTMLElement>(id: string): T {
|
||||
@ -37,14 +37,14 @@ export class HtmlUtils {
|
||||
if (typeof html === "string") {
|
||||
return sanitizeHtml(html, {
|
||||
allowedAttributes: {
|
||||
'span': ['style'],
|
||||
span: ["style"],
|
||||
},
|
||||
allowedStyles: {
|
||||
'span': {
|
||||
'color': [/^#(0x)?[0-9a-f]+$/i, /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/],
|
||||
'font-size': [/^\d+(?:px|em|%)$/]
|
||||
}
|
||||
}
|
||||
span: {
|
||||
color: [/^#(0x)?[0-9a-f]+$/i, /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/],
|
||||
"font-size": [/^\d+(?:px|em|%)$/],
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
return "";
|
||||
|
@ -129,7 +129,7 @@ class JitsiFactory {
|
||||
* Slugifies the room name and prepends the room name with the instance
|
||||
*/
|
||||
public getRoomName(roomName: string, instance: string): string {
|
||||
if (!instance || instance == '') {
|
||||
if (!instance || instance == "") {
|
||||
return slugify(roomName);
|
||||
}
|
||||
return slugify(instance.replace("/", "-") + "-" + roomName);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const emoji: NonNullable<Translation["emoji"]> = {
|
||||
search: "Emojis suchent...",
|
||||
search: "Emojis suchen...",
|
||||
categories: {
|
||||
recents: "Letzte Emojis",
|
||||
smileys: "Smileys & Emotionen",
|
||||
|
@ -4,15 +4,18 @@ const error: NonNullable<Translation["error"]> = {
|
||||
accessLink: {
|
||||
title: "Ungültiger Zugangslink",
|
||||
subTitle: "Karte konnte nicht gefunden werden. Prüfe bitte deinen Zugangslink.",
|
||||
details: "Für weitere Information kannst du die Administratoren kontaktieren oder melde dich bei uns unter: prty@bstly.de",
|
||||
details:
|
||||
"Für weitere Information kannst du die Administratoren kontaktieren oder melde dich bei uns unter: prty@bstly.de",
|
||||
},
|
||||
connectionRejected: {
|
||||
title: "Verbindungen zurückgewiesen",
|
||||
subTitle: "Du kannst diese Welt nicht betreten. Versuche es später noch einmal {error}.",
|
||||
details: "Für weitere Information kannst du die Administratoren kontaktieren oder melde dich bei uns unter: prty.bstly.de",
|
||||
details:
|
||||
"Für weitere Information kannst du die Administratoren kontaktieren oder melde dich bei uns unter: prty.bstly.de",
|
||||
},
|
||||
connectionRetry: {
|
||||
unableConnect: "Es konnte keine Verbindung zu WorkAdventure erstellt werden. Bist du mit dem Internet verbunden?",
|
||||
unableConnect:
|
||||
"Es konnte keine Verbindung zu WorkAdventure erstellt werden. Bist du mit dem Internet verbunden?",
|
||||
},
|
||||
error: "Fehler",
|
||||
};
|
||||
|
@ -90,7 +90,8 @@ const menu: NonNullable<Translation["menu"]> = {
|
||||
},
|
||||
createMap: {
|
||||
title: "Eigene Karte erstellen ",
|
||||
description: "Du kannst auch deine eigene Karte erstellen. Folge dazu unserer Schritt-für-Schritt Anleitung.",
|
||||
description:
|
||||
"Du kannst auch deine eigene Karte erstellen. Folge dazu unserer Schritt-für-Schritt Anleitung.",
|
||||
},
|
||||
},
|
||||
about: {
|
||||
|
@ -7,7 +7,8 @@ const warning: NonNullable<Translation["warning"]> = {
|
||||
limit: "Diese Welt erreicht bald die maximale Kapazität!",
|
||||
accessDenied: {
|
||||
camera: "Zugriff auf die Kamera verweigert. Hier klicken um deine Browser Berechtigungen zu prüfen.",
|
||||
screenSharing: "Zugriff auf die Bildschirmfreigabe verweigert. Hier klicken um deine Browser Berechtigungen zu prüfen.",
|
||||
screenSharing:
|
||||
"Zugriff auf die Bildschirmfreigabe verweigert. Hier klicken um deine Browser Berechtigungen zu prüfen.",
|
||||
},
|
||||
importantMessage: "Wichtige Nachricht",
|
||||
connectionLost: "Verbindungen unterbrochen. Wiederverbinden...",
|
||||
|
@ -153,7 +153,13 @@ const wa = {
|
||||
/**
|
||||
* @deprecated Use WA.ui.openPopup instead
|
||||
*/
|
||||
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[], popupClass : string, input : boolean): Popup {
|
||||
openPopup(
|
||||
targetObject: string,
|
||||
message: string,
|
||||
buttons: ButtonDescriptor[],
|
||||
popupClass: string,
|
||||
input: boolean
|
||||
): Popup {
|
||||
console.warn("Method WA.openPopup is deprecated. Please use WA.ui.openPopup instead");
|
||||
return ui.openPopup(targetObject, message, buttons, popupClass, input);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user