add the possibilities of "onaction" and message to new "openTab" property
This commit is contained in:
parent
352b05b1ea
commit
94517c0f4b
@ -13,10 +13,28 @@ export class GameMapPropertiesListener {
|
|||||||
constructor(private scene: GameScene, private gameMap: GameMap) {}
|
constructor(private scene: GameScene, private gameMap: GameMap) {}
|
||||||
|
|
||||||
register() {
|
register() {
|
||||||
this.gameMap.onPropertyChange("openTab", (newValue) => {
|
this.gameMap.onPropertyChange("openTab", (newValue, oldvalue, allProps) => {
|
||||||
|
if (newValue === undefined) {
|
||||||
|
layoutManagerActionStore.removeAction("openTab");
|
||||||
|
}
|
||||||
if (typeof newValue == "string" && newValue.length) {
|
if (typeof newValue == "string" && newValue.length) {
|
||||||
|
const openWebsiteTriggerValue = allProps.get(TRIGGER_WEBSITE_PROPERTIES);
|
||||||
|
if (openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
|
||||||
|
let message = allProps.get(WEBSITE_MESSAGE_PROPERTIES);
|
||||||
|
if (message === undefined) {
|
||||||
|
message = "Press SPACE or touch here to open web site in new tab";
|
||||||
|
}
|
||||||
|
layoutManagerActionStore.addAction({
|
||||||
|
uuid: "openTab",
|
||||||
|
type: "message",
|
||||||
|
message: message,
|
||||||
|
callback: () => scriptUtils.openTab(newValue),
|
||||||
|
userInputManager: this.scene.userInputManager,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
scriptUtils.openTab(newValue);
|
scriptUtils.openTab(newValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.gameMap.onPropertyChange("openWebsite", (newValue, oldValue, allProps) => {
|
this.gameMap.onPropertyChange("openWebsite", (newValue, oldValue, allProps) => {
|
||||||
if (newValue === undefined) {
|
if (newValue === undefined) {
|
||||||
|
Loading…
Reference in New Issue
Block a user