Add First Version of Tuto

PopUp
Player Control disable
Fake bubble displayed
This commit is contained in:
DESKTOP-FMM8UI0\CLV 2021-03-12 16:39:29 +01:00
parent fa4d917729
commit c5c8770a60
8 changed files with 174 additions and 65 deletions

View file

@ -13,6 +13,10 @@ interface WorkAdventureApi {
onEnterZone(name: string, callback: () => void): void;
onLeaveZone(name: string, callback: () => void): void;
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
disablePlayerControl() : void;
enablePlayerControl() : void;
displayBubble() : void;
removeBubble() : void;
}
declare global {
@ -62,7 +66,6 @@ class Popup {
}
}
window.WA = {
/**
* Send a message in the chat.
@ -77,6 +80,22 @@ window.WA = {
} as ChatEvent
}, '*');
},
disablePlayerControl() : void {
window.parent.postMessage({'type' : 'disablePlayerControl'},'*');
},
enablePlayerControl() : void {
window.parent.postMessage({'type' : 'enablePlayerControl'},'*');
},
displayBubble() : void {
window.parent.postMessage({'type' : 'displayBubble'},'*');
},
removeBubble() : void {
window.parent.postMessage({'type' : 'removeBubble'},'*');
},
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup {
popupId++;
const popup = new Popup(popupId);
@ -165,6 +184,7 @@ window.addEventListener('message', message => {
callback(popup);
}
}
}
// ...