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') { else if(payload.type === 'closeCoWebSite') {
scriptUtils.closeCoWebSite(); scriptUtils.closeCoWebSite();
} }
else if(payload.type === 'closeChatMessage') {
scriptUtils.closeChatMessage();
}
else if (payload.type === 'disablePlayerControl'){ else if (payload.type === 'disablePlayerControl'){
this._disablePlayerControlStream.next(); this._disablePlayerControlStream.next();
} }

View File

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

View File

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

View File

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