workadventure/maps/Village/scriptMapVillage.js

63 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-04-07 13:06:30 +02:00
var zoneOfficeName = "popupOfficeZone";
var zoneEventName = "popupEventZone";
var zoneSchoolName = "popupSchoolZone";
var zoneTCMName = "popupTCMZone";
var urlPricing = "https://workadventu.re/pricing";
var urlSchoolOffer = "https://workadventu.re/school-offer";
2021-04-08 09:41:53 +02:00
var urlEvent = "https://workadventu.re/events";
2021-04-07 13:06:30 +02:00
var currentPopup = undefined;
WA.onEnterZone(zoneOfficeName, () => {
currentPopup = WA.openPopup("popUpOffice","You can purchase virtual office in WorkAdventure",[
{
label: "See the pricing",
className: "popUpElement",
callback: (popup => {
WA.openTab(urlPricing);
})
}]);
})
WA.onEnterZone(zoneEventName, () => {
currentPopup = WA.openPopup("popUpEvent","You can create your own Event in WorkAdventure",[
{
2021-04-08 09:41:53 +02:00
label: "See the event page",
2021-04-07 13:06:30 +02:00
className: "popUpElement",
callback: (popup => {
2021-04-08 09:41:53 +02:00
WA.openTab(urlEvent);
2021-04-07 13:06:30 +02:00
})
}]);
})
WA.onEnterZone(zoneTCMName, () => {
currentPopup = WA.openPopup("popUpTCM","Come meet the WorkAdventure team in our office ! ",[]);
2021-04-07 13:06:30 +02:00
})
WA.onEnterZone(zoneSchoolName, () => {
currentPopup = WA.openPopup("popUpSchool","WorkAdventure is free for teachers a the moment ! Take advantage of our offer ",[
{
label: "See the offer",
className: "popUpElement",
callback: (popup => {
WA.openTab(urlSchoolOffer);
})
}]);
})
2021-04-08 10:50:41 +02:00
WA.onLeaveZone(zoneSchoolName, closePopUp)
2021-04-07 13:06:30 +02:00
2021-04-08 10:50:41 +02:00
WA.onLeaveZone(zoneTCMName, closePopUp)
2021-04-07 13:06:30 +02:00
2021-04-08 10:50:41 +02:00
WA.onLeaveZone(zoneEventName, closePopUp)
WA.onLeaveZone(zoneOfficeName, closePopUp)
function closePopUp(){
2021-04-07 13:06:30 +02:00
if (currentPopup !== undefined) {
currentPopup.close();
currentPopup = undefined;
}
2021-04-08 10:50:41 +02:00
}