Added discussion scripting

This commit is contained in:
_Bastler 2021-05-16 10:22:05 +02:00
parent e7727e122e
commit b4fc8c6d27
4 changed files with 18 additions and 3 deletions

View File

@ -95,6 +95,9 @@ class IframeListener {
else if(payload.type === 'closeCoWebSite') {
scriptUtils.closeCoWebSite();
}
else if(payload.type === 'closeChatMessage') {
scriptUtils.closeChatMessage();
}
else if (payload.type === 'disablePlayerControl'){
this._disablePlayerControlStream.next();
}

View File

@ -1,4 +1,6 @@
import {coWebsiteManager} from "../WebRtc/CoWebsiteManager";
import {discussionManager} from "../WebRtc/DiscussionManager";
class ScriptUtils {
@ -11,12 +13,16 @@ class ScriptUtils {
}
public closeCoWebSite(){
coWebsiteManager.closeCoWebsite();
}
public openCoWebsite(url : string){
coWebsiteManager.loadCoWebsite(url,url);
}
public closeCoWebSite(){
coWebsiteManager.closeCoWebsite();
public closeChatMessage(){
discussionManager.hideDiscussion();
}
}

View File

@ -223,7 +223,7 @@ export class DiscussionManager {
this.divDiscuss?.classList.add('active');
}
private hideDiscussion(){
public hideDiscussion(){
this.activeDiscussion = false;
this.divDiscuss?.classList.remove('active');
}

View File

@ -13,6 +13,7 @@ import {OpenCoWebSiteEvent} from "./Api/Events/OpenCoWebSiteEvent";
interface WorkAdventureApi {
sendChatMessage(message: string, author: string): void;
onChatMessage(callback: (message: string) => void): void;
closeChatMessage() : void;
onEnterZone(name: string, callback: () => void): void;
onLeaveZone(name: string, callback: () => void): void;
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
@ -88,6 +89,11 @@ window.WA = {
} as ChatEvent
}, '*');
},
closeChatMessage() : void{
window.parent.postMessage({
"type" : 'closeChatMessage'
},'*');
},
disablePlayerControl() : void {
window.parent.postMessage({'type' : 'disablePlayerControl'},'*');
},