Merge remote-tracking branch 'remotes/workadventure-main/develop' into gamestate-api-read
This commit is contained in:
commit
ce0c7ea3eb
146 changed files with 7765 additions and 1891 deletions
|
@ -1,14 +1,14 @@
|
|||
import {ChatEvent, isChatEvent} from "./Api/Events/ChatEvent";
|
||||
import {isIframeEventWrapper} from "./Api/Events/IframeEvent";
|
||||
import {isUserInputChatEvent, UserInputChatEvent} from "./Api/Events/UserInputChatEvent";
|
||||
import {Subject} from "rxjs";
|
||||
import {EnterLeaveEvent, isEnterLeaveEvent} from "./Api/Events/EnterLeaveEvent";
|
||||
import {OpenPopupEvent} from "./Api/Events/OpenPopupEvent";
|
||||
import {isButtonClickedEvent} from "./Api/Events/ButtonClickedEvent";
|
||||
import {ClosePopupEvent} from "./Api/Events/ClosePopupEvent";
|
||||
import {OpenTabEvent} from "./Api/Events/OpenTabEvent";
|
||||
import {GoToPageEvent} from "./Api/Events/GoToPageEvent";
|
||||
import {OpenCoWebSiteEvent} from "./Api/Events/OpenCoWebSiteEvent";
|
||||
import { ChatEvent } from "./Api/Events/ChatEvent";
|
||||
import { isIframeResponseEventWrapper } from "./Api/Events/IframeEvent";
|
||||
import { isUserInputChatEvent, UserInputChatEvent } from "./Api/Events/UserInputChatEvent";
|
||||
import { Subject } from "rxjs";
|
||||
import { EnterLeaveEvent, isEnterLeaveEvent } from "./Api/Events/EnterLeaveEvent";
|
||||
import { OpenPopupEvent } from "./Api/Events/OpenPopupEvent";
|
||||
import { isButtonClickedEvent } from "./Api/Events/ButtonClickedEvent";
|
||||
import { ClosePopupEvent } from "./Api/Events/ClosePopupEvent";
|
||||
import { OpenTabEvent } from "./Api/Events/OpenTabEvent";
|
||||
import { GoToPageEvent } from "./Api/Events/GoToPageEvent";
|
||||
import { OpenCoWebSiteEvent } from "./Api/Events/OpenCoWebSiteEvent";
|
||||
import { GameStateEvent, isGameStateEvent } from './Api/Events/ApiGameStateEvent';
|
||||
|
||||
interface WorkAdventureApi {
|
||||
|
@ -21,10 +21,10 @@ interface WorkAdventureApi {
|
|||
goToPage(url : string): void;
|
||||
openCoWebSite(url : string): void;
|
||||
closeCoWebSite(): void;
|
||||
disablePlayerControl() : void;
|
||||
restorePlayerControl() : void;
|
||||
displayBubble() : void;
|
||||
removeBubble() : void;
|
||||
disablePlayerControl(): void;
|
||||
restorePlayerControl(): void;
|
||||
displayBubble(): void;
|
||||
removeBubble(): void;
|
||||
getGameState():Promise<unknown>
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ interface ButtonDescriptor {
|
|||
/**
|
||||
* The type of the button. Can be one of "normal", "primary", "success", "warning", "error", "disabled"
|
||||
*/
|
||||
className?: "normal"|"primary"|"success"|"warning"|"error"|"disabled",
|
||||
className?: "normal" | "primary" | "success" | "warning" | "error" | "disabled",
|
||||
/**
|
||||
* Callback called if the button is pressed
|
||||
*/
|
||||
|
@ -106,38 +106,38 @@ window.WA = {
|
|||
} as ChatEvent
|
||||
}, '*');
|
||||
},
|
||||
disablePlayerControl() : void {
|
||||
window.parent.postMessage({'type' : 'disablePlayerControl'},'*');
|
||||
disablePlayerControl(): void {
|
||||
window.parent.postMessage({ 'type': 'disablePlayerControl' }, '*');
|
||||
},
|
||||
|
||||
restorePlayerControl() : void {
|
||||
window.parent.postMessage({'type' : 'restorePlayerControl'},'*');
|
||||
restorePlayerControl(): void {
|
||||
window.parent.postMessage({ 'type': 'restorePlayerControl' }, '*');
|
||||
},
|
||||
|
||||
displayBubble() : void {
|
||||
window.parent.postMessage({'type' : 'displayBubble'},'*');
|
||||
displayBubble(): void {
|
||||
window.parent.postMessage({ 'type': 'displayBubble' }, '*');
|
||||
},
|
||||
|
||||
removeBubble() : void {
|
||||
window.parent.postMessage({'type' : 'removeBubble'},'*');
|
||||
removeBubble(): void {
|
||||
window.parent.postMessage({ 'type': 'removeBubble' }, '*');
|
||||
},
|
||||
|
||||
openTab(url : string) : void{
|
||||
openTab(url: string): void {
|
||||
window.parent.postMessage({
|
||||
"type" : 'openTab',
|
||||
"data" : {
|
||||
"type": 'openTab',
|
||||
"data": {
|
||||
url
|
||||
} as OpenTabEvent
|
||||
},'*');
|
||||
}, '*');
|
||||
},
|
||||
|
||||
goToPage(url : string) : void{
|
||||
goToPage(url: string): void {
|
||||
window.parent.postMessage({
|
||||
"type" : 'goToPage',
|
||||
"data" : {
|
||||
"type": 'goToPage',
|
||||
"data": {
|
||||
url
|
||||
} as GoToPageEvent
|
||||
},'*');
|
||||
}, '*');
|
||||
},
|
||||
|
||||
openCoWebSite(url : string) : void{
|
||||
|
@ -146,13 +146,13 @@ window.WA = {
|
|||
"data" : {
|
||||
url
|
||||
} as OpenCoWebSiteEvent
|
||||
},'*');
|
||||
}, '*');
|
||||
},
|
||||
|
||||
closeCoWebSite() : void{
|
||||
closeCoWebSite(): void {
|
||||
window.parent.postMessage({
|
||||
"type" : 'closeCoWebSite'
|
||||
},'*');
|
||||
"type": 'closeCoWebSite'
|
||||
}, '*');
|
||||
},
|
||||
|
||||
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup {
|
||||
|
@ -223,9 +223,9 @@ window.addEventListener('message', message => {
|
|||
|
||||
const payload = message.data;
|
||||
|
||||
console.log(payload);
|
||||
console.debug(payload);
|
||||
|
||||
if (isIframeEventWrapper(payload)) {
|
||||
if (isIframeResponseEventWrapper(payload)) {
|
||||
const payloadData = payload.data;
|
||||
if (payload.type === 'userInputChat' && isUserInputChatEvent(payloadData)) {
|
||||
userInputChatStream.next(payloadData);
|
||||
|
@ -237,7 +237,7 @@ window.addEventListener('message', message => {
|
|||
const callback = popupCallbacks.get(payloadData.popupId)?.get(payloadData.buttonId);
|
||||
const popup = popups.get(payloadData.popupId);
|
||||
if (popup === undefined) {
|
||||
throw new Error('Could not find popup with ID "'+payloadData.popupId+'"');
|
||||
throw new Error('Could not find popup with ID "' + payloadData.popupId + '"');
|
||||
}
|
||||
if (callback) {
|
||||
callback(popup);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue