Adding placeHolder Popup tuto to Map2

need to cut player controller and simulate bobble
This commit is contained in:
DESKTOP-FMM8UI0\CLV 2021-03-11 10:58:48 +01:00
parent f9f618094d
commit 6441fa71d3
3 changed files with 618 additions and 17 deletions

View File

@ -79,11 +79,9 @@ window.WA = {
}, },
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup { openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup {
popupId++; popupId++;
const popup = new Popup(popupId); const popup = new Popup(popupId);
const btnMap = new Map<number, () => void>(); const btnMap = new Map<number, () => void>();
popupCallbacks.set(popupId, btnMap); popupCallbacks.set(popupId, btnMap);
targetObject = "tutoBobble";
let id = 0; let id = 0;
for (const button of buttons) { for (const button of buttons) {
const callback = button.callback; const callback = button.callback;
@ -95,6 +93,7 @@ window.WA = {
id++; id++;
} }
window.parent.postMessage({ window.parent.postMessage({
'type': 'openPopup', 'type': 'openPopup',
'data': { 'data': {

597
maps/tests/map2.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
console.log('SCRIPT LAUNCHED'); console.log('SCRIPT LAUNCHED');
WA.sendChatMessage('Hi, my name is Poly and I repeat what you say!', 'Poly Parrot'); //WA.sendChatMessage('Hi, my name is Poly and I repeat what you say!', 'Poly Parrot');
WA.onChatMessage((message => { WA.onChatMessage((message => {
console.log('CHAT MESSAGE RECEIVED BY SCRIPT'); console.log('CHAT MESSAGE RECEIVED BY SCRIPT');
@ -11,8 +10,7 @@ WA.onEnterZone('myTrigger', () => {
WA.sendChatMessage("Don't step on my carpet!", 'Poly Parrot'); WA.sendChatMessage("Don't step on my carpet!", 'Poly Parrot');
}) })
WA.onLeaveZone('myTrigger', () => { WA.onLeaveZone('popupZone', () => {
WA.sendChatMessage("Thanks!", 'Poly Parrot');
}) })
WA.onEnterZone('notExist', () => { WA.onEnterZone('notExist', () => {
@ -20,23 +18,30 @@ WA.onEnterZone('notExist', () => {
}) })
WA.onEnterZone('popupZone', () => { WA.onEnterZone('popupZone', () => {
WA.openPopup('foobar', 'This is a test message. Hi!', [ WA.openPopup('tutoBobble', 'Hey ! This is how to open start a discussion with someone ! You can be 4 max in a booble ', [
{ {
label: "Close", label: "Next",
className: "normal", className: "normal",
callback: (popup) => { callback: (popup) => {
popup.close(); popup.close();
}
}, WA.openPopup('tutoChat', 'You can also use the chat to communicate ! ',[
{ {
label: "Next", label : "Open Chat",
className: "success", className : "normal",
callback: (popup) => { callback: (popup1)=> {
popup.close(); WA.sendChatMessage("Hey you can talk here too ! ", 'WA Guide');
popup1.close();
}
}
])
} }
} }
]) ]);
}) });
/*WA.onLeaveZone('popupZone', () => { /*WA.onLeaveZone('popupZone', () => {
WA.sendChatMessage("Thanks!", 'Poly Parrot'); WA.sendChatMessage("Thanks!", 'Poly Parrot');