1.1.0 • Published 3 years ago
simple-workadventure v1.1.0
simple-workadventure
A simplified workadveture-api with extra functions
installation
install with:
npm install simple-workadventuresetup
paste this in your empty map script:
/// <reference types="@workadventure/iframe-api-typings" />
import WAsimple from "simple-workadventure";
const WAs = new WAsimple()
WAs.init().then(() => {
//your code here
})
export {};propertys
buttons
close
a simple popUp close Button:
WAs.buttons.closecreator functions
button creators
createCloseButton
WAs.createCloseButton("label")- this returns a close Button for PopUps
- label can be left empty for the standard "close" - labeling but you can write somthing i there to change the label (maybe for your language)
createLinkButton
WAs.createLinkButton("url","label")- this returns a Link Button for a PopUp that opens the Website in a new Tab when clicked
- url is the url you want to open in a new Tab
- label is the text you want to be displayed on the button
createCoWebsiteButton
WAs.createCoWebsiteButton("url","label")- this returns a Link Button for a PopUp that opens the Website in a CoWebsite window when clicked
- url is the url you want to open in the CoWebsite
- label is the text you want to be displayed on the button
functions
popUp
WAs.popUp("display","text",[]) // opens intantlyWAs.popUp("display","text",[], "area") // opens when walked over "area"-area- display is the area where you want your popup to be displayed
- text is the text you want to be shown
- [] should be filled with ButtonDescriptors can be left empty (you can also fill it with
WAs.buttons.closeto add a close button or use one of the buttonCreators) - area is the area where you have to walk over so that your popup shows up this can be left undefined to open it instantly
modal
WAs.modal("title","src", true) // opens intantlyWAs.modal("title","src", true, "area") // opens when walked over "area"-area- title is the title that shoud be displayed over the modal
- src is the url that should be displayed in the modal
- api is a boolean whether or not the workadveture-api should work in the modal
- area is the area where you have to walk over so that your popup shows up this can be left undefined to open it instantly
cameraZoomButton
WAs.cameraZoomButton(x, y, "zoomTooltip", "playerTooltip")depricated
- popUpOnArea (use popUp instead)
- modalOnArea (use Modal instead)
- cameraEvent (use cameraZoomButton instead)
todo
- finish documentation