prettier
This commit is contained in:
parent
31f6847b53
commit
e3b58a0d56
@ -6,7 +6,8 @@ export const isButtonClickedEvent = new tg.IsInterface()
|
|||||||
buttonId: tg.isNumber,
|
buttonId: tg.isNumber,
|
||||||
input: tg.isBoolean,
|
input: tg.isBoolean,
|
||||||
inputValue: tg.isString,
|
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.
|
* 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({
|
.withProperties({
|
||||||
popupId: tg.isNumber,
|
popupId: tg.isNumber,
|
||||||
inputValue: tg.isString,
|
inputValue: tg.isString,
|
||||||
}).get();
|
})
|
||||||
|
.get();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message sent from the iFrame to the game to add a message in the chat.
|
* A message sent from the iFrame to the game to add a message in the chat.
|
||||||
|
@ -13,9 +13,10 @@ export const isOpenPopupEvent = new tg.IsInterface()
|
|||||||
targetObject: tg.isString,
|
targetObject: tg.isString,
|
||||||
message: tg.isString,
|
message: tg.isString,
|
||||||
buttons: tg.isArray(isButtonDescriptor),
|
buttons: tg.isArray(isButtonDescriptor),
|
||||||
popupClass : tg.isString,
|
popupClass: tg.isString,
|
||||||
input: tg.isBoolean
|
input: tg.isBoolean,
|
||||||
}).get();
|
})
|
||||||
|
.get();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message sent from the iFrame to the game to add a message in the chat.
|
* 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 {
|
unregisterIframe(iframe: HTMLIFrameElement): void {
|
||||||
this._unregisterIFrameStream.next();
|
this._unregisterIFrameStream.next();
|
||||||
this.iframeCloseCallbacks.get(iframe)?.forEach(callback => {
|
this.iframeCloseCallbacks.get(iframe)?.forEach((callback) => {
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
this.iframes.delete(iframe);
|
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({
|
this.postMessage({
|
||||||
type: "buttonClickedEvent",
|
type: "buttonClickedEvent",
|
||||||
data: {
|
data: {
|
||||||
@ -486,7 +486,7 @@ class IframeListener {
|
|||||||
buttonId,
|
buttonId,
|
||||||
input,
|
input,
|
||||||
inputValue,
|
inputValue,
|
||||||
} as ButtonClickedEvent
|
} as ButtonClickedEvent,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,10 @@ import { sendToWorkadventure } from "../IframeApiContribution";
|
|||||||
import type { ClosePopupEvent } from "../../Events/ClosePopupEvent";
|
import type { ClosePopupEvent } from "../../Events/ClosePopupEvent";
|
||||||
|
|
||||||
export class Popup {
|
export class Popup {
|
||||||
|
|
||||||
inputValue: string;
|
inputValue: string;
|
||||||
|
|
||||||
constructor(private id: number) {
|
constructor(private id: number) {
|
||||||
this.inputValue = '';
|
this.inputValue = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,11 +13,11 @@ export class Popup {
|
|||||||
*/
|
*/
|
||||||
public close(): void {
|
public close(): void {
|
||||||
sendToWorkadventure({
|
sendToWorkadventure({
|
||||||
'type': 'closePopup',
|
type: "closePopup",
|
||||||
'data': {
|
data: {
|
||||||
'popupId': this.id,
|
popupId: this.id,
|
||||||
'inputValue': this.inputValue,
|
inputValue: this.inputValue,
|
||||||
} as ClosePopupEvent
|
} as ClosePopupEvent,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,12 +131,13 @@ export class WorkadventureRoomCommands extends IframeApiContribution<Workadventu
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getProperty(layerName: string, propertyName: string): Promise<string | number | boolean | undefined> {
|
async getProperty(layerName: string, propertyName: string): Promise<string | number | boolean | undefined> {
|
||||||
const event = await queryWorkadventure({
|
const event = await queryWorkadventure({
|
||||||
type: "getProperty", data: {
|
type: "getProperty",
|
||||||
|
data: {
|
||||||
layerName: layerName,
|
layerName: layerName,
|
||||||
propertyName: propertyName,
|
propertyName: propertyName,
|
||||||
propertyValue : undefined,
|
propertyValue: undefined,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
return event.propertyValue;
|
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++;
|
popupId++;
|
||||||
const popup = new Popup(popupId);
|
const popup = new Popup(popupId);
|
||||||
const btnMap = new Map<number, () => void>();
|
const btnMap = new Map<number, () => void>();
|
||||||
@ -114,7 +120,7 @@ export class WorkAdventureUiCommands extends IframeApiContribution<WorkAdventure
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
popupClass,
|
popupClass,
|
||||||
input
|
input,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -360,7 +360,6 @@ class ConnectionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getWorlds() {
|
async getWorlds() {
|
||||||
|
|
||||||
const token = localUserStore.getAuthToken();
|
const token = localUserStore.getAuthToken();
|
||||||
if (!token) {
|
if (!token) {
|
||||||
throw new Error("No token provided");
|
throw new Error("No token provided");
|
||||||
@ -368,8 +367,7 @@ class ConnectionManager {
|
|||||||
|
|
||||||
const { worlds } = await Axios.get(`${PUSHER_URL}/worlds`, { params: { token } }).then((res) => {
|
const { worlds } = await Axios.get(`${PUSHER_URL}/worlds`, { params: { token } }).then((res) => {
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
return worlds;
|
return worlds;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ export class Room {
|
|||||||
//const match = /@\/([^/]+)\/([^/]+)\/.+/.exec(this.id);
|
//const match = /@\/([^/]+)\/([^/]+)\/.+/.exec(this.id);
|
||||||
//if (!match) throw new Error('Could not extract instance from "' + this.id + '"');
|
//if (!match) throw new Error('Could not extract instance from "' + this.id + '"');
|
||||||
//this.instance = match[1] + "/" + match[2];
|
//this.instance = match[1] + "/" + match[2];
|
||||||
this.instance = ""
|
this.instance = "";
|
||||||
return this.instance;
|
return this.instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export interface World {
|
export interface World {
|
||||||
roomId: string;
|
roomId: string;
|
||||||
player: string[];
|
player: string[];
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ export const HAIR_RESOURCES: BodyResourceDescriptionListInterface = {
|
|||||||
hair_72: { name: "hair_72", img: "resources/customisation/character_hairs/character_hairs71.png" },
|
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_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_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 = {
|
export const CLOTHES_RESOURCES: BodyResourceDescriptionListInterface = {
|
||||||
@ -435,8 +435,8 @@ export const ACCESSORIES_RESOURCES: BodyResourceDescriptionListInterface = {
|
|||||||
img: "resources/customisation/character_accessories/mate_bottle1.png",
|
img: "resources/customisation/character_accessories/mate_bottle1.png",
|
||||||
},
|
},
|
||||||
accessory_mask: { name: "accessory_mask", img: "resources/customisation/character_accessories/mask.png" },
|
accessory_mask: { name: "accessory_mask", img: "resources/customisation/character_accessories/mask.png" },
|
||||||
wheelchair: {
|
wheelchair: {
|
||||||
name: "accessory_wheelchair",
|
name: "accessory_wheelchair",
|
||||||
img: "resources/customisation/character_accessories/wheelchair.png",
|
img: "resources/customisation/character_accessories/wheelchair.png",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -255,10 +255,7 @@ export class GameMap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getLayerProperty(
|
public getLayerProperty(layerName: string, propertyName: string): string | number | undefined | boolean {
|
||||||
layerName: string,
|
|
||||||
propertyName: string
|
|
||||||
) : string | number | undefined | boolean {
|
|
||||||
const layer = this.findLayer(layerName);
|
const layer = this.findLayer(layerName);
|
||||||
if (layer === undefined) {
|
if (layer === undefined) {
|
||||||
console.warn('Could not find layer "' + layerName + '" when calling setProperty');
|
console.warn('Could not find layer "' + layerName + '" when calling setProperty');
|
||||||
|
@ -161,17 +161,26 @@ export class GameMapPropertiesListener {
|
|||||||
callback: () => openWebsiteFunction(),
|
callback: () => openWebsiteFunction(),
|
||||||
userInputManager: this.scene.userInputManager,
|
userInputManager: this.scene.userInputManager,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
this.coWebsitesIframeListeners.set(layer, iframeListener.unregisterIFrameStream.subscribe(() => {
|
this.coWebsitesIframeListeners.set(
|
||||||
const coWebsiteOpen = this.coWebsitesOpenByLayer.get(layer);
|
layer,
|
||||||
if (coWebsiteOpen?.coWebsite?.state == CoWebsiteState.CLOSED && (!websiteTriggerProperty || websiteTriggerProperty !== ON_ACTION_TRIGGER_DISABLE)) {
|
iframeListener.unregisterIFrameStream.subscribe(() => {
|
||||||
createWebsiteTrigger();
|
const coWebsiteOpen = this.coWebsitesOpenByLayer.get(layer);
|
||||||
}
|
if (
|
||||||
}));
|
coWebsiteOpen?.coWebsite?.state == CoWebsiteState.CLOSED &&
|
||||||
|
(!websiteTriggerProperty || websiteTriggerProperty !== ON_ACTION_TRIGGER_DISABLE)
|
||||||
|
) {
|
||||||
|
createWebsiteTrigger();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const forceTrigger = localUserStore.getForceCowebsiteTrigger();
|
const forceTrigger = localUserStore.getForceCowebsiteTrigger();
|
||||||
if (forceTrigger || websiteTriggerProperty && websiteTriggerProperty === ON_ACTION_TRIGGER_BUTTON) {
|
if (
|
||||||
|
forceTrigger ||
|
||||||
|
(websiteTriggerProperty && websiteTriggerProperty === ON_ACTION_TRIGGER_BUTTON)
|
||||||
|
) {
|
||||||
createWebsiteTrigger();
|
createWebsiteTrigger();
|
||||||
} else {
|
} else {
|
||||||
this.coWebsitesOpenByLayer.set(layer, {
|
this.coWebsitesOpenByLayer.set(layer, {
|
||||||
@ -215,7 +224,6 @@ export class GameMapPropertiesListener {
|
|||||||
|
|
||||||
const coWebsiteIframeListener = this.coWebsitesIframeListeners.get(layer);
|
const coWebsiteIframeListener = this.coWebsitesIframeListeners.get(layer);
|
||||||
|
|
||||||
|
|
||||||
if (coWebsiteIframeListener) {
|
if (coWebsiteIframeListener) {
|
||||||
coWebsiteIframeListener.unsubscribe();
|
coWebsiteIframeListener.unsubscribe();
|
||||||
this.coWebsitesIframeListeners.delete(layer);
|
this.coWebsitesIframeListeners.delete(layer);
|
||||||
@ -232,7 +240,10 @@ export class GameMapPropertiesListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coWebsiteOpen.state !== OpenCoWebsiteState.OPENED && coWebsiteOpen.state !== OpenCoWebsiteState.TRIGGER) {
|
if (
|
||||||
|
coWebsiteOpen.state !== OpenCoWebsiteState.OPENED &&
|
||||||
|
coWebsiteOpen.state !== OpenCoWebsiteState.TRIGGER
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ export class GameScene extends DirtyScene {
|
|||||||
const base = new URL(window.location.href);
|
const base = new URL(window.location.href);
|
||||||
base.pathname = "";
|
base.pathname = "";
|
||||||
const url = new URL(file.src, base.toString());
|
const url = new URL(file.src, base.toString());
|
||||||
const host = url.host.split(":")[ 0 ];
|
const host = url.host.split(":")[0];
|
||||||
if (
|
if (
|
||||||
window.location.protocol === "https:" &&
|
window.location.protocol === "https:" &&
|
||||||
file.src === this.MapUrlFile &&
|
file.src === this.MapUrlFile &&
|
||||||
@ -337,8 +337,8 @@ export class GameScene extends DirtyScene {
|
|||||||
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
(this.load as any).rexWebFont({
|
(this.load as any).rexWebFont({
|
||||||
custom: {
|
custom: {
|
||||||
families: [ "Press Start 2P" ],
|
families: ["Press Start 2P"],
|
||||||
urls: [ "/resources/fonts/fonts.css" ],
|
urls: ["/resources/fonts/fonts.css"],
|
||||||
testString: "abcdefg",
|
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.
|
// 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;
|
let itemFactory: ItemFactoryInterface;
|
||||||
@ -787,8 +787,8 @@ export class GameScene extends DirtyScene {
|
|||||||
if (item === undefined) {
|
if (item === undefined) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Received an event about object "' +
|
'Received an event about object "' +
|
||||||
message.itemId +
|
message.itemId +
|
||||||
'" but cannot find this item on the map.'
|
'" but cannot find this item on the map.'
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1061,8 +1061,8 @@ export class GameScene extends DirtyScene {
|
|||||||
} else {
|
} else {
|
||||||
console.error(
|
console.error(
|
||||||
"Error while opening a popup. Cannot find an object on the map with name '" +
|
"Error while opening a popup. Cannot find an object on the map with name '" +
|
||||||
openPopupEvent.targetObject +
|
openPopupEvent.targetObject +
|
||||||
"'. The first parameter of WA.openPopup() must be the name of a rectangle object in your map."
|
"'. The first parameter of WA.openPopup() must be the name of a rectangle object in your map."
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1070,7 +1070,7 @@ export class GameScene extends DirtyScene {
|
|||||||
let html = `<div id="container" hidden><div class="nes-container with-title is-centered">`;
|
let html = `<div id="container" hidden><div class="nes-container with-title is-centered">`;
|
||||||
html += escapedMessage;
|
html += escapedMessage;
|
||||||
if (openPopupEvent.input) {
|
if (openPopupEvent.input) {
|
||||||
html += `<input id="popupinput-${openPopupEvent.popupId}" class="nes-input" />`
|
html += `<input id="popupinput-${openPopupEvent.popupId}" class="nes-input" />`;
|
||||||
}
|
}
|
||||||
html += `</div>`;
|
html += `</div>`;
|
||||||
|
|
||||||
@ -1102,11 +1102,18 @@ export class GameScene extends DirtyScene {
|
|||||||
);
|
);
|
||||||
const btnId = id;
|
const btnId = id;
|
||||||
button.onclick = () => {
|
button.onclick = () => {
|
||||||
let inputValue = '';
|
let inputValue = "";
|
||||||
if (openPopupEvent.input) {
|
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
|
// Disable for a short amount of time to let time to the script to remove the popup
|
||||||
button.disabled = true;
|
button.disabled = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -1370,18 +1377,20 @@ export class GameScene extends DirtyScene {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.iframeSubscriptionList.push(iframeListener.setTilesStream.subscribe((eventTiles) => {
|
this.iframeSubscriptionList.push(
|
||||||
for (const eventTile of eventTiles) {
|
iframeListener.setTilesStream.subscribe((eventTiles) => {
|
||||||
this.gameMap.putTile(eventTile.tile, eventTile.x, eventTile.y, eventTile.layer);
|
for (const eventTile of eventTiles) {
|
||||||
}
|
this.gameMap.putTile(eventTile.tile, eventTile.x, eventTile.y, eventTile.layer);
|
||||||
}))
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
iframeListener.registerAnswerer("loadTileset", (eventTileset) => {
|
iframeListener.registerAnswerer("loadTileset", (eventTileset) => {
|
||||||
return this.connectionAnswerPromise.then(() => {
|
return this.connectionAnswerPromise.then(() => {
|
||||||
const jsonTilesetDir = eventTileset.url.substr(0, eventTileset.url.lastIndexOf("/"));
|
const jsonTilesetDir = eventTileset.url.substr(0, eventTileset.url.lastIndexOf("/"));
|
||||||
//Initialise the firstgid to 1 because if there is no tileset in the tilemap, the firstgid will be 1
|
//Initialise the firstgid to 1 because if there is no tileset in the tilemap, the firstgid will be 1
|
||||||
let newFirstgid = 1;
|
let newFirstgid = 1;
|
||||||
const lastTileset = this.mapFile.tilesets[ this.mapFile.tilesets.length - 1 ];
|
const lastTileset = this.mapFile.tilesets[this.mapFile.tilesets.length - 1];
|
||||||
if (lastTileset) {
|
if (lastTileset) {
|
||||||
//If there is at least one tileset in the tilemap then calculate the firstgid of the new tileset
|
//If there is at least one tileset in the tilemap then calculate the firstgid of the new tileset
|
||||||
newFirstgid = lastTileset.firstgid + lastTileset.tilecount;
|
newFirstgid = lastTileset.firstgid + lastTileset.tilecount;
|
||||||
@ -1530,14 +1539,14 @@ export class GameScene extends DirtyScene {
|
|||||||
if (phaserLayers === []) {
|
if (phaserLayers === []) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Could not find layer with name that contains "' +
|
'Could not find layer with name that contains "' +
|
||||||
layerName +
|
layerName +
|
||||||
'" when calling WA.hideLayer / WA.showLayer'
|
'" when calling WA.hideLayer / WA.showLayer'
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < phaserLayers.length; i++) {
|
for (let i = 0; i < phaserLayers.length; i++) {
|
||||||
phaserLayers[ i ].setVisible(visible);
|
phaserLayers[i].setVisible(visible);
|
||||||
phaserLayers[ i ].setCollisionByProperty({ collides: true }, visible);
|
phaserLayers[i].setCollisionByProperty({ collides: true }, visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
@ -2191,7 +2200,10 @@ export class GameScene extends DirtyScene {
|
|||||||
layoutManagerActionStore.removeAction("jitsi");
|
layoutManagerActionStore.removeAction("jitsi");
|
||||||
} else {
|
} else {
|
||||||
const openJitsiRoomFunction = () => {
|
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;
|
const jitsiUrl = allProps.get(GameMapProperties.JITSI_URL) as string | undefined;
|
||||||
if (JITSI_PRIVATE_MODE && !jitsiUrl) {
|
if (JITSI_PRIVATE_MODE && !jitsiUrl) {
|
||||||
const adminTag = allProps.get(GameMapProperties.JITSI_ADMIN_ROOM_TAG) as string | undefined;
|
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);
|
this.startJitsi(roomName, undefined);
|
||||||
}
|
}
|
||||||
layoutManagerActionStore.removeAction("jitsi");
|
layoutManagerActionStore.removeAction("jitsi");
|
||||||
}
|
};
|
||||||
|
|
||||||
let message = allProps.get(GameMapProperties.JITSI_TRIGGER_MESSAGE);
|
let message = allProps.get(GameMapProperties.JITSI_TRIGGER_MESSAGE);
|
||||||
if (message === undefined) {
|
if (message === undefined) {
|
||||||
|
@ -53,15 +53,14 @@ export class StartPositionCalculator {
|
|||||||
selectedOrDefaultLayer = defaultStartLayerName;
|
selectedOrDefaultLayer = defaultStartLayerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedOrDefaultLayer = selectedOrDefaultLayer.replace('#','');
|
selectedOrDefaultLayer = selectedOrDefaultLayer.replace("#", "");
|
||||||
|
|
||||||
let foundLayer: ITiledMapLayer | null = null;
|
let foundLayer: ITiledMapLayer | null = null;
|
||||||
for (const layer of this.gameMap.flatLayers) {
|
for (const layer of this.gameMap.flatLayers) {
|
||||||
if (layer.type !== "tilelayer") continue;
|
if (layer.type !== "tilelayer") continue;
|
||||||
//we want to prioritize the selectedLayer other the start layer
|
//we want to prioritize the selectedLayer other the start layer
|
||||||
if (
|
if (
|
||||||
(selectedOrDefaultLayer === layer.name ||
|
(selectedOrDefaultLayer === layer.name || layer.name.endsWith("/" + selectedOrDefaultLayer)) &&
|
||||||
layer.name.endsWith("/" + selectedOrDefaultLayer)) &&
|
|
||||||
layer.type === "tilelayer" &&
|
layer.type === "tilelayer" &&
|
||||||
(selectedOrDefaultLayer === defaultStartLayerName || this.isStartLayer(layer))
|
(selectedOrDefaultLayer === defaultStartLayerName || this.isStartLayer(layer))
|
||||||
) {
|
) {
|
||||||
|
@ -37,7 +37,7 @@ export type CoWebsite = {
|
|||||||
iframe: HTMLIFrameElement;
|
iframe: HTMLIFrameElement;
|
||||||
// icon: HTMLDivElement;
|
// icon: HTMLDivElement;
|
||||||
position: number;
|
position: number;
|
||||||
state : CoWebsiteState;
|
state: CoWebsiteState;
|
||||||
};
|
};
|
||||||
|
|
||||||
type CoWebsiteSlot = {
|
type CoWebsiteSlot = {
|
||||||
@ -539,7 +539,7 @@ class CoWebsiteManager {
|
|||||||
|
|
||||||
const coWebsite = {
|
const coWebsite = {
|
||||||
iframe,
|
iframe,
|
||||||
state : CoWebsiteState.OPENED,
|
state: CoWebsiteState.OPENED,
|
||||||
position: position ?? this.coWebsites.length,
|
position: position ?? this.coWebsites.length,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const sanitizeHtml = require('sanitize-html');
|
const sanitizeHtml = require("sanitize-html");
|
||||||
|
|
||||||
export class HtmlUtils {
|
export class HtmlUtils {
|
||||||
public static getElementByIdOrFail<T extends HTMLElement>(id: string): T {
|
public static getElementByIdOrFail<T extends HTMLElement>(id: string): T {
|
||||||
@ -33,22 +33,22 @@ export class HtmlUtils {
|
|||||||
return p.innerHTML;
|
return p.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static sanitize(html : string | number | boolean | undefined): string {
|
public static sanitize(html: string | number | boolean | undefined): string {
|
||||||
if (typeof html === "string") {
|
if (typeof html === "string") {
|
||||||
return sanitizeHtml(html, {
|
return sanitizeHtml(html, {
|
||||||
allowedAttributes: {
|
allowedAttributes: {
|
||||||
'span': ['style'],
|
span: ["style"],
|
||||||
},
|
},
|
||||||
allowedStyles: {
|
allowedStyles: {
|
||||||
'span': {
|
span: {
|
||||||
'color': [/^#(0x)?[0-9a-f]+$/i, /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/],
|
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|%)$/]
|
"font-size": [/^\d+(?:px|em|%)$/],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static urlify(text: string, style: string = ""): string {
|
public static urlify(text: string, style: string = ""): string {
|
||||||
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
||||||
|
@ -129,7 +129,7 @@ class JitsiFactory {
|
|||||||
* Slugifies the room name and prepends the room name with the instance
|
* Slugifies the room name and prepends the room name with the instance
|
||||||
*/
|
*/
|
||||||
public getRoomName(roomName: string, instance: string): string {
|
public getRoomName(roomName: string, instance: string): string {
|
||||||
if (!instance || instance == '') {
|
if (!instance || instance == "") {
|
||||||
return slugify(roomName);
|
return slugify(roomName);
|
||||||
}
|
}
|
||||||
return slugify(instance.replace("/", "-") + "-" + roomName);
|
return slugify(instance.replace("/", "-") + "-" + roomName);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Translation } from "../i18n-types";
|
import type { Translation } from "../i18n-types";
|
||||||
|
|
||||||
const emoji: NonNullable<Translation["emoji"]> = {
|
const emoji: NonNullable<Translation["emoji"]> = {
|
||||||
search: "Emojis suchent...",
|
search: "Emojis suchen...",
|
||||||
categories: {
|
categories: {
|
||||||
recents: "Letzte Emojis",
|
recents: "Letzte Emojis",
|
||||||
smileys: "Smileys & Emotionen",
|
smileys: "Smileys & Emotionen",
|
||||||
|
@ -4,15 +4,18 @@ const error: NonNullable<Translation["error"]> = {
|
|||||||
accessLink: {
|
accessLink: {
|
||||||
title: "Ungültiger Zugangslink",
|
title: "Ungültiger Zugangslink",
|
||||||
subTitle: "Karte konnte nicht gefunden werden. Prüfe bitte deinen 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: {
|
connectionRejected: {
|
||||||
title: "Verbindungen zurückgewiesen",
|
title: "Verbindungen zurückgewiesen",
|
||||||
subTitle: "Du kannst diese Welt nicht betreten. Versuche es später noch einmal {error}.",
|
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: {
|
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",
|
error: "Fehler",
|
||||||
};
|
};
|
||||||
|
@ -90,7 +90,8 @@ const menu: NonNullable<Translation["menu"]> = {
|
|||||||
},
|
},
|
||||||
createMap: {
|
createMap: {
|
||||||
title: "Eigene Karte erstellen ",
|
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: {
|
about: {
|
||||||
|
@ -7,7 +7,8 @@ const warning: NonNullable<Translation["warning"]> = {
|
|||||||
limit: "Diese Welt erreicht bald die maximale Kapazität!",
|
limit: "Diese Welt erreicht bald die maximale Kapazität!",
|
||||||
accessDenied: {
|
accessDenied: {
|
||||||
camera: "Zugriff auf die Kamera verweigert. Hier klicken um deine Browser Berechtigungen zu prüfen.",
|
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",
|
importantMessage: "Wichtige Nachricht",
|
||||||
connectionLost: "Verbindungen unterbrochen. Wiederverbinden...",
|
connectionLost: "Verbindungen unterbrochen. Wiederverbinden...",
|
||||||
|
@ -153,7 +153,13 @@ const wa = {
|
|||||||
/**
|
/**
|
||||||
* @deprecated Use WA.ui.openPopup instead
|
* @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");
|
console.warn("Method WA.openPopup is deprecated. Please use WA.ui.openPopup instead");
|
||||||
return ui.openPopup(targetObject, message, buttons, popupClass, input);
|
return ui.openPopup(targetObject, message, buttons, popupClass, input);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user