Merge remote-tracking branch 'remotes/workadventure-main/develop' into load-page-api
# Conflicts: # front/src/Api/Events/IframeEvent.ts # front/src/Api/IframeListener.ts # front/src/Phaser/Game/GameScene.ts # front/src/iframe_api.ts
This commit is contained in:
commit
238f333b81
204 changed files with 6943 additions and 4151 deletions
|
@ -1,14 +1,18 @@
|
|||
import { ChatEvent } from "./Api/Events/ChatEvent";
|
||||
import type { 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 type { 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 type { ClosePopupEvent } from "./Api/Events/ClosePopupEvent";
|
||||
import type { OpenTabEvent } from "./Api/Events/OpenTabEvent";
|
||||
import type { GoToPageEvent } from "./Api/Events/GoToPageEvent";
|
||||
import type { OpenCoWebSiteEvent } from "./Api/Events/OpenCoWebSiteEvent";
|
||||
import type {PlaySoundEvent} from "./Api/Events/PlaySoundEvent";
|
||||
import type {StopSoundEvent} from "./Api/Events/StopSoundEvent";
|
||||
import type {LoadSoundEvent} from "./Api/Events/LoadSoundEvent";
|
||||
import SoundConfig = Phaser.Types.Sound.SoundConfig;
|
||||
import { LoadPageEvent } from './Api/Events/LoadPageEvent';
|
||||
|
||||
interface WorkAdventureApi {
|
||||
|
@ -22,10 +26,11 @@ interface WorkAdventureApi {
|
|||
exitSceneTo(url : string): void;
|
||||
openCoWebSite(url : string): void;
|
||||
closeCoWebSite(): void;
|
||||
disablePlayerControl(): void;
|
||||
restorePlayerControl(): void;
|
||||
disablePlayerControls(): void;
|
||||
restorePlayerControls(): void;
|
||||
displayBubble(): void;
|
||||
removeBubble(): void;
|
||||
loadSound(url : string): Sound;
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
@ -59,7 +64,7 @@ interface ButtonDescriptor {
|
|||
callback: ButtonClickedCallback,
|
||||
}
|
||||
|
||||
class Popup {
|
||||
export class Popup {
|
||||
constructor(private id: number) {
|
||||
}
|
||||
|
||||
|
@ -76,6 +81,41 @@ class Popup {
|
|||
}
|
||||
}
|
||||
|
||||
export class Sound {
|
||||
constructor(private url: string) {
|
||||
window.parent.postMessage({
|
||||
"type" : 'loadSound',
|
||||
"data": {
|
||||
url: this.url,
|
||||
} as LoadSoundEvent
|
||||
|
||||
},'*');
|
||||
}
|
||||
|
||||
public play(config : SoundConfig) {
|
||||
window.parent.postMessage({
|
||||
"type" : 'playSound',
|
||||
"data": {
|
||||
url: this.url,
|
||||
config
|
||||
} as PlaySoundEvent
|
||||
|
||||
},'*');
|
||||
return this.url;
|
||||
}
|
||||
public stop() {
|
||||
window.parent.postMessage({
|
||||
"type" : 'stopSound',
|
||||
"data": {
|
||||
url: this.url,
|
||||
} as StopSoundEvent
|
||||
|
||||
},'*');
|
||||
return this.url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
window.WA = {
|
||||
/**
|
||||
* Send a message in the chat.
|
||||
|
@ -90,12 +130,12 @@ window.WA = {
|
|||
} as ChatEvent
|
||||
}, '*');
|
||||
},
|
||||
disablePlayerControl(): void {
|
||||
window.parent.postMessage({ 'type': 'disablePlayerControl' }, '*');
|
||||
disablePlayerControls(): void {
|
||||
window.parent.postMessage({ 'type': 'disablePlayerControls' }, '*');
|
||||
},
|
||||
|
||||
restorePlayerControl(): void {
|
||||
window.parent.postMessage({ 'type': 'restorePlayerControl' }, '*');
|
||||
restorePlayerControls(): void {
|
||||
window.parent.postMessage({ 'type': 'restorePlayerControls' }, '*');
|
||||
},
|
||||
|
||||
displayBubble(): void {
|
||||
|
@ -115,7 +155,11 @@ window.WA = {
|
|||
}, '*');
|
||||
},
|
||||
|
||||
goToPage(url: string): void {
|
||||
loadSound(url: string) : Sound {
|
||||
return new Sound(url);
|
||||
},
|
||||
|
||||
goToPage(url : string) : void{
|
||||
window.parent.postMessage({
|
||||
"type": 'goToPage',
|
||||
"data": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue