import type { Observable, Subscription } from "rxjs"; import type { ITiledMap } from "@workadventure/tiled-map-type-guard"; import { IframeApiContribution } from "./IframeApiContribution"; import type { WorkadventureRoomWebsiteCommands } from "./website"; import type { WorkadventureAreaCommands } from "./area"; export interface TileDescriptor { x: number; y: number; tile: number | string | null; layer: string; } export declare const setRoomId: (id: string) => void; export declare const setHashParameters: (theHashParameters: Record) => void; export declare const setMapURL: (url: string) => void; export declare class WorkadventureRoomCommands extends IframeApiContribution { callbacks: ({ type: "enterEvent"; callback: (event: { name: string; }) => void; } | { type: "leaveEvent"; callback: (event: { name: string; }) => void; })[]; /** * @deprecated Use onEnterLayer instead */ onEnterZone(name: string, callback: () => void): Subscription; /** * @deprecated Use onLeaveLayer instead */ onLeaveZone(name: string, callback: () => void): Subscription; /** * Listens to the position of the current user. The event is triggered when the user enters a given layer. * {@link https://docs.workadventu.re/map-building/api-room.md#detecting-when-the-user-entersleaves-a-layer | Website documentation} * * @param {string} layerName Name of the layer who as defined in Tiled * @returns {Observable<{ reason: "initial" | "move" }>} RxJS observable triggered when someone enters the layer */ onEnterLayer(layerName: string): Observable<{ reason: "initial" | "move"; }>; /** * Listens to the position of the current user. The event is triggered when the user leaves a given layer. * {@link https://docs.workadventu.re/map-building/api-room.md#detecting-when-the-user-entersleaves-a-layer | Website documentation} * * @param {string} layerName Name of the layer who as defined in Tiled * @returns {Observable<{ reason: "initial" | "move" }>} RxJS observable triggered when someone leaves the layer */ onLeaveLayer(layerName: string): Observable<{ reason: "initial" | "move"; }>; /** * This methods can be used to show a layer. if layerName is the name of a group layer, show all the layer in that group layer. * {@link https://docs.workadventu.re/map-building/api-room.md#show--hide-a-layer | Website documentation} * * @param {string} layerName Name of the layer/group layer who as defined in Tiled */ showLayer(layerName: string): void; /** * This methods can be used to hide a layer. if layerName is the name of a group layer, hide all the layer in that group layer. * {@link https://docs.workadventu.re/map-building/api-room.md#show--hide-a-layer | Website documentation} * * @param {string} layerName Name of the layer/group layer who as defined in Tiled */ hideLayer(layerName: string): void; /** * Set the value of the propertyName property of the layer layerName at propertyValue. * If the property doesn't exist, create the property propertyName and set the value of the property at propertyValue. * Note : To unset a property from a layer, use setProperty with propertyValue set to undefined. * {@link https://docs.workadventu.re/map-building/api-room.md#setcreate-properties-in-a-layer | Website documentation} * * @param {string} layerName Name of the layer who as defined in Tiled * @param {string} propertyName Name of the property * @param {string|number|boolean|undefined} propertyValue Value of the property */ setProperty(layerName: string, propertyName: string, propertyValue: string | number | boolean | undefined): void; /** * Returns a promise that resolves to the JSON map file. * Check the {@link https://doc.mapeditor.org/en/stable/reference/json-map-format/ | Tiled documentation to learn more about the format of the JSON map}. * {@link https://docs.workadventu.re/map-building/api-room.md#getting-map-data | Website documentation} * * @returns {Promise} Map in Tiled JSON format */ getTiledMap(): Promise; /** * Replace the tile at the x and y coordinates in the layer named layer by the tile with the id tile. * {@link https://docs.workadventu.re/map-building/api-room.md#changing-tiles | Website documentation} * * @param {TileDescriptor[]} tiles Description of a tile */ setTiles(tiles: TileDescriptor[]): void; /** * The ID of the current room is available from the WA.room.id property. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-room.md#get-the-room-id | Website documentation} * * @returns {string} Id of the room */ get id(): string; /** * The URL of the map is available from the WA.room.mapURL property. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-room.md#get-the-map-url | Website documentation} * * @returns {string} Url of the map */ get mapURL(): string; /** * The parameters behind the hash (#) of the URL are available from the WA.room.hashParameters property. * They should follow the format key=value&key2=value2. */ get hashParameters(): Record; /** * Load a tileset in JSON format from a url and return the id of the first tile of the loaded tileset. * {@link https://docs.workadventu.re/map-building/api-room.md#loading-a-tileset | Website documentation} * * @param {string} url Url of the tileset * @returns {Promise} Promise to return the id of the tileset */ loadTileset(url: string): Promise; get website(): WorkadventureRoomWebsiteCommands; get area(): WorkadventureAreaCommands; } declare const _default: WorkadventureRoomCommands; export default _default;