@workadventure/scripting-api-extra
Advanced tools
Comparing version
import { Properties } from "../Properties"; | ||
import { defaultAssetsUrl } from "./default_assets_url"; | ||
import { getLayersMap } from "../LayersFlattener"; | ||
import { openConfig } from "../VariablesExtra"; | ||
let layersMap; | ||
@@ -22,3 +23,3 @@ export async function initConfiguration(assetsUrl) { | ||
if (openConfigVariables && layer.type === "tilelayer") { | ||
initLocalConfigurationPanel(openConfigVariables, properties); | ||
initLocalConfigurationPanel(openConfigVariables.split(","), layer.name, properties); | ||
} | ||
@@ -28,8 +29,4 @@ } | ||
} | ||
function initLocalConfigurationPanel(openConfigVariables, properties) { | ||
function initLocalConfigurationPanel(openConfigVariables, layerName, properties) { | ||
let actionMessage = undefined; | ||
const zoneName = properties.getString("zone"); | ||
if (!zoneName) { | ||
throw new Error('Missing "zone" property'); | ||
} | ||
const tag = properties.getString("openConfigAdminTag"); | ||
@@ -47,3 +44,3 @@ let allowedByTag = true; | ||
message: (_a = properties.getString("openConfigTriggerMessage")) !== null && _a !== void 0 ? _a : "Press SPACE or touch here to configure", | ||
callback: () => openConfigurationPanel(openConfigVariables), | ||
callback: () => openConfig(openConfigVariables), | ||
}); | ||
@@ -54,3 +51,3 @@ } | ||
} | ||
WA.room.onEnterZone(zoneName, () => { | ||
WA.room.onEnterLayer(layerName).subscribe(() => { | ||
const openConfigTriggerValue = properties.getString("openConfigTrigger"); | ||
@@ -62,7 +59,7 @@ if (allowedByTag) { | ||
else { | ||
openConfigurationPanel(openConfigVariables); | ||
openConfig(openConfigVariables); | ||
} | ||
} | ||
}); | ||
WA.room.onLeaveZone(zoneName, () => { | ||
WA.room.onLeaveLayer(layerName).subscribe(() => { | ||
if (actionMessage) { | ||
@@ -77,6 +74,2 @@ actionMessage.remove(); | ||
} | ||
function openConfigurationPanel(variablesToConfigure) { | ||
const parameters = variablesToConfigure ? "#" + variablesToConfigure : ""; | ||
WA.nav.openCoWebSite(defaultAssetsUrl + "/configuration.html" + parameters, true); | ||
} | ||
//# sourceMappingURL=configuration.js.map |
@@ -1,1 +0,1 @@ | ||
export declare const defaultAssetsUrl = "https://unpkg.com/@workadventure/scripting-api-extra@1.2.2/dist"; | ||
export declare const defaultAssetsUrl = "https://unpkg.com/@workadventure/scripting-api-extra@1.3.0/dist"; |
@@ -1,2 +0,2 @@ | ||
export const defaultAssetsUrl = "https://unpkg.com/@workadventure/scripting-api-extra@1.2.2/dist"; | ||
export const defaultAssetsUrl = "https://unpkg.com/@workadventure/scripting-api-extra@1.3.0/dist"; | ||
//# sourceMappingURL=default_assets_url.js.map |
@@ -5,2 +5,3 @@ import "./style/style.scss"; | ||
let firstMovementDone = false; | ||
const maxStep = 5; | ||
if (/Mobi|Android/i.test(navigator.userAgent)) { | ||
@@ -14,7 +15,7 @@ showContentForDevice("mobile"); | ||
initializeClickableBtns("skip-btn", () => { | ||
currentStep = "end"; | ||
currentStep = maxStep; | ||
WA.room.website.delete("tutorial"); | ||
}); | ||
WA.player.onPlayerMove(() => { | ||
if (!firstMovementDone && typeof currentStep == "number") { | ||
if (!firstMovementDone) { | ||
firstMovementDone = true; | ||
@@ -26,4 +27,4 @@ goToNextStep(); | ||
var _a, _b; | ||
if (currentStep === "end") { | ||
return; | ||
if (currentStep === maxStep) { | ||
WA.room.website.delete("tutorial"); | ||
} | ||
@@ -30,0 +31,0 @@ (_a = document.getElementById(`step-${currentStep}`)) === null || _a === void 0 ? void 0 : _a.classList.add("hidden"); |
@@ -12,2 +12,3 @@ import type { ITiledMapObject } from "@workadventure/tiled-map-type-guard/dist"; | ||
} | ||
export declare function openConfig(variables?: string[]): void; | ||
export declare function getVariables(layerFilter?: string, variablesFilter?: Array<string>): Promise<Map<string, VariableDescriptor>>; |
import { Properties } from "./Properties"; | ||
import { defaultAssetsUrl } from "./Features/default_assets_url"; | ||
export class VariableDescriptor { | ||
@@ -24,2 +25,6 @@ constructor(object) { | ||
} | ||
export function openConfig(variables) { | ||
const parameters = variables ? "#" + variables.join() : ""; | ||
WA.nav.openCoWebSite(defaultAssetsUrl + "/configuration.html" + parameters); | ||
} | ||
export async function getVariables(layerFilter, variablesFilter) { | ||
@@ -26,0 +31,0 @@ const map = await WA.room.getTiledMap(); |
{ | ||
"name": "@workadventure/scripting-api-extra", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "A set of utility functions / features to improve WorkAdventure maps", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
4770959
0.04%108
0.93%