2021-06-23 17:32:32 +02:00
|
|
|
///<reference path="../../front/src/iframe_api.ts" />
|
2021-03-07 21:02:38 +01:00
|
|
|
console.log('SCRIPT LAUNCHED');
|
2021-03-11 10:58:48 +01:00
|
|
|
//WA.sendChatMessage('Hi, my name is Poly and I repeat what you say!', 'Poly Parrot');
|
2021-03-12 16:39:29 +01:00
|
|
|
var isFirstTimeTuto = false;
|
|
|
|
var textFirstPopup = 'Hey ! This is how to open start a discussion with someone ! You can be 4 max in a booble';
|
|
|
|
var textSecondPopup = 'You can also use the chat to communicate ! ';
|
2021-06-23 17:32:32 +02:00
|
|
|
var targetObjectTutoBubble = 'myPopup1';
|
|
|
|
var targetObjectTutoChat = 'myPopup2';
|
2021-03-12 16:39:29 +01:00
|
|
|
var popUpExplanation = undefined;
|
2021-06-23 17:32:32 +02:00
|
|
|
function launchTuto() {
|
|
|
|
WA.ui.openPopup(targetObjectTutoBubble, textFirstPopup, [
|
|
|
|
{
|
|
|
|
label: "Next",
|
|
|
|
className: "popUpElement",
|
|
|
|
callback: (popup) => {
|
|
|
|
popup.close();
|
2021-03-07 21:02:38 +01:00
|
|
|
|
2021-06-23 17:32:32 +02:00
|
|
|
WA.ui.openPopup(targetObjectTutoChat, textSecondPopup, [
|
|
|
|
{
|
|
|
|
label: "Open Chat",
|
|
|
|
className: "popUpElement",
|
|
|
|
callback: (popup1) => {
|
|
|
|
WA.chat.sendChatMessage("Hey you can talk here too ! ", 'WA Guide');
|
|
|
|
popup1.close();
|
|
|
|
WA.controls.restorePlayerControls();
|
2021-03-12 16:39:29 +01:00
|
|
|
}
|
2021-06-23 17:32:32 +02:00
|
|
|
}
|
2021-03-12 16:39:29 +01:00
|
|
|
|
2021-06-23 17:32:32 +02:00
|
|
|
])
|
2021-03-12 16:39:29 +01:00
|
|
|
}
|
2021-06-23 17:32:32 +02:00
|
|
|
}
|
|
|
|
]);
|
|
|
|
WA.controls.disablePlayerControls();
|
2021-03-12 16:39:29 +01:00
|
|
|
|
|
|
|
}
|
2021-06-18 18:29:45 +02:00
|
|
|
WA.chat.onChatMessage((message => {
|
2021-03-07 21:02:38 +01:00
|
|
|
console.log('CHAT MESSAGE RECEIVED BY SCRIPT');
|
2021-06-23 17:32:32 +02:00
|
|
|
WA.chat.sendChatMessage('Poly Parrot says: "' + message + '"', 'Poly Parrot');
|
2021-03-07 21:02:38 +01:00
|
|
|
}));
|
2021-03-08 18:57:59 +01:00
|
|
|
|
2021-06-18 18:29:45 +02:00
|
|
|
WA.room.onEnterZone('myTrigger', () => {
|
|
|
|
WA.chat.sendChatMessage("Don't step on my carpet!", 'Poly Parrot');
|
2021-10-18 14:34:47 +02:00
|
|
|
WA.chat.sendChatMessage("Yeah, don't step on her carpet!", 'Peter Parrot');
|
2021-03-08 18:57:59 +01:00
|
|
|
})
|
|
|
|
|
2021-06-18 18:29:45 +02:00
|
|
|
WA.room.onLeaveZone('popupZone', () => {
|
2021-03-08 18:57:59 +01:00
|
|
|
})
|
|
|
|
|
2021-06-18 18:29:45 +02:00
|
|
|
WA.room.onEnterZone('notExist', () => {
|
|
|
|
WA.chat.sendChatMessage("YOU SHOULD NEVER SEE THIS", 'Poly Parrot');
|
2021-03-08 18:57:59 +01:00
|
|
|
})
|
2021-03-09 16:21:14 +01:00
|
|
|
|
2021-06-18 18:29:45 +02:00
|
|
|
WA.room.onEnterZone('popupZone', () => {
|
|
|
|
WA.ui.displayBubble();
|
2021-06-23 17:32:32 +02:00
|
|
|
if(!isFirstTimeTuto) {
|
2021-03-12 16:39:29 +01:00
|
|
|
isFirstTimeTuto = true;
|
|
|
|
launchTuto();
|
|
|
|
}
|
2021-06-23 17:32:32 +02:00
|
|
|
else popUpExplanation = WA.ui.openPopup(targetObjectTutoChat, 'Do you want to review the explanation ? ', [
|
2021-03-09 16:21:14 +01:00
|
|
|
{
|
2021-03-12 16:39:29 +01:00
|
|
|
label: "No",
|
2021-03-22 16:10:21 +01:00
|
|
|
className: "popUpElementReviewexplanation",
|
2021-03-09 18:51:30 +01:00
|
|
|
callback: (popup) => {
|
|
|
|
popup.close();
|
2021-03-12 16:39:29 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "Yes",
|
2021-03-22 16:10:21 +01:00
|
|
|
className: "popUpElementReviewexplanation",
|
2021-03-12 16:39:29 +01:00
|
|
|
callback: (popup) => {
|
|
|
|
popup.close();
|
|
|
|
launchTuto();
|
2021-03-09 16:21:14 +01:00
|
|
|
}
|
|
|
|
}
|
2021-03-12 16:39:29 +01:00
|
|
|
])
|
2021-03-11 10:58:48 +01:00
|
|
|
});
|
2021-03-09 16:21:14 +01:00
|
|
|
|
2021-06-18 18:29:45 +02:00
|
|
|
WA.room.onLeaveZone('popupZone', () => {
|
2021-06-23 17:32:32 +02:00
|
|
|
if(popUpExplanation !== undefined) popUpExplanation.close();
|
2021-06-18 18:29:45 +02:00
|
|
|
WA.ui.removeBubble();
|
2021-03-12 16:39:29 +01:00
|
|
|
})
|
2021-06-23 17:32:32 +02:00
|
|
|
|
2021-08-04 19:31:17 +02:00
|
|
|
const message = WA.ui.displayActionMessage("testMessage", () => {
|
2021-06-23 17:32:32 +02:00
|
|
|
WA.chat.sendChatMessage("triggered", "triggerbot");
|
|
|
|
})
|
|
|
|
setTimeout(() => {
|
|
|
|
message.remove();
|
2021-08-04 19:31:17 +02:00
|
|
|
}, 5000)
|