added example script for map exit

This commit is contained in:
jonny 2021-04-29 10:43:51 +02:00
parent 006195e8cc
commit 8f6c65384a

View File

@ -1,14 +1,16 @@
/// <reference path="../../front/src/iframe_api.ts" />
var zoneName = "popUpGoToPageZone";
var urlPricing = "https://workadventu.re/pricing";
var urlGettingStarted = "https://workadventu.re/getting-started";
var isCoWebSiteOpened = false;
var urlRelativeMap = "script_api.json";
var isCoWebSiteOpened = false;
WA.onChatMessage((message => {
WA.sendChatMessage('Poly Parrot says: "'+message+'"', 'Poly Parrot');
WA.sendChatMessage('Poly Parrot says: "' + message + '"', 'Poly Parrot');
}));
WA.onEnterZone(zoneName, () => {
WA.openPopup("popUp","Open Links",[
WA.openPopup("popUp", "Open Links", [
{
label: "Open Tab",
className: "popUpElement",
@ -18,27 +20,34 @@ WA.onEnterZone(zoneName, () => {
})
},
{
label: "Go To Page", className : "popUpElement",
callback:(popup => {
label: "Go To Page", className: "popUpElement",
callback: (popup => {
WA.goToPage(urlPricing);
popup.close();
})
}
,
},
{
label: "openCoWebSite", className : "popUpElement",
callback:(popup => {
label: "openCoWebSite", className: "popUpElement",
callback: (popup => {
WA.openCoWebSite(urlPricing);
isCoWebSiteOpened = true;
popup.close();
})
}, {
label: "load grouped map",
className: "popUpElement",
callback: (popup => {
WA.loadPage(urlRelativeMap);
popup.close();
})
}]);
})
WA.onLeaveZone(zoneName, () => {
if (isCoWebSiteOpened) {
if(isCoWebSiteOpened) {
WA.closeCoWebSite();
isCoWebSiteOpened = false;
}