@workadventure/iframe-api-typings 1.8.2 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/desktop/electron/src/preload-app/types.d.ts +8 -0
- package/front/src/Api/Events/ActionsMenuActionClickedEvent.d.ts +7 -0
- package/front/src/Api/Events/AddActionsMenuKeyToRemotePlayerEvent.d.ts +7 -0
- package/{Api → front/src/Api}/Events/ButtonClickedEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/CameraFollowPlayerEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/CameraSetEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/ChangeLayerEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/ChangeZoneEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/ChatEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/ClosePopupEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/ColorEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/EmbeddedWebsiteEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/EnterLeaveEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/GameStateEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/GoToPageEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/HasPlayerMovedEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/IframeEvent.d.ts +13 -4
- package/{Api → front/src/Api}/Events/LayerEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/LoadPageEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/LoadSoundEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/LoadTilesetEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/MapDataEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/MovePlayerToEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/MovePlayerToEventAnswer.d.ts +0 -0
- package/{Api → front/src/Api}/Events/OpenCoWebsiteEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/OpenPopupEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/OpenTabEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/PlaySoundEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/PlayerPosition.d.ts +0 -0
- package/front/src/Api/Events/RemotePlayerClickedEvent.d.ts +9 -0
- package/front/src/Api/Events/RemoveActionsMenuKeyFromRemotePlayerEvent.d.ts +7 -0
- package/{Api → front/src/Api}/Events/SetTilesEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/SetVariableEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/StopSoundEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/UserInputChatEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/WasCameraUpdatedEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/setPropertyEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/ui/MenuItemClickedEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/ui/MenuRegisterEvent.d.ts +0 -0
- package/{Api → front/src/Api}/Events/ui/TriggerActionMessageEvent.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/IframeApiContribution.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/Room/EmbeddedWebsite.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/Sound/Sound.d.ts +1 -0
- package/{Api → front/src/Api}/iframe/Ui/ActionMessage.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/Ui/ButtonDescriptor.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/Ui/Menu.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/Ui/Popup.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/camera.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/chat.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/controls.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/nav.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/player.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/registeredCallbacks.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/room.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/sound.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/state.d.ts +0 -0
- package/{Api → front/src/Api}/iframe/ui.d.ts +26 -0
- package/{Api → front/src/Api}/iframe/website.d.ts +0 -0
- package/{Api → front/src/Api}/types.d.ts +0 -0
- package/front/src/Phaser/Map/ITiledMap.d.ts +170 -0
- package/{iframe_api.d.ts → front/src/iframe_api.d.ts} +0 -6
- package/package.json +1 -1
- package/Api/Events/CloseCoWebsiteEvent.d.ts +0 -8
- package/Api/Events/ui/TriggerMessageEventHandler.d.ts +0 -14
- package/Api/IframeListener.d.ts +0 -158
- package/Api/ScriptUtils.d.ts +0 -8
- package/Api/iframe/Ui/MenuItem.d.ts +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type WorkAdventureDesktopApi = {
|
|
2
|
+
desktop: boolean;
|
|
3
|
+
isDevelopment: () => Promise<boolean>;
|
|
4
|
+
getVersion: () => Promise<string>;
|
|
5
|
+
notify: (txt: string) => void;
|
|
6
|
+
onMuteToggle: (callback: () => void) => void;
|
|
7
|
+
onCameraToggle: (callback: () => void) => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as tg from "generic-type-guard";
|
|
2
|
+
export declare const isActionsMenuActionClickedEvent: tg.TypeGuard<object & {
|
|
3
|
+
id: number;
|
|
4
|
+
actionName: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare type ActionsMenuActionClickedEvent = tg.GuardedType<typeof isActionsMenuActionClickedEvent>;
|
|
7
|
+
export declare type ActionsMenuActionClickedEventCallback = (event: ActionsMenuActionClickedEvent) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as tg from "generic-type-guard";
|
|
2
|
+
export declare const isAddActionsMenuKeyToRemotePlayerEvent: tg.TypeGuard<object & {
|
|
3
|
+
id: number;
|
|
4
|
+
actionKey: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare type AddActionsMenuKeyToRemotePlayerEvent = tg.GuardedType<typeof isAddActionsMenuKeyToRemotePlayerEvent>;
|
|
7
|
+
export declare type AddActionsMenuKeyToRemotePlayerEventCallback = (event: AddActionsMenuKeyToRemotePlayerEvent) => void;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -25,6 +25,10 @@ import type { WasCameraUpdatedEvent } from "./WasCameraUpdatedEvent";
|
|
|
25
25
|
import type { ChangeZoneEvent } from "./ChangeZoneEvent";
|
|
26
26
|
import type { CameraSetEvent } from "./CameraSetEvent";
|
|
27
27
|
import type { CameraFollowPlayerEvent } from "./CameraFollowPlayerEvent";
|
|
28
|
+
import type { RemotePlayerClickedEvent } from "./RemotePlayerClickedEvent";
|
|
29
|
+
import type { AddActionsMenuKeyToRemotePlayerEvent } from "./AddActionsMenuKeyToRemotePlayerEvent";
|
|
30
|
+
import type { ActionsMenuActionClickedEvent } from "./ActionsMenuActionClickedEvent";
|
|
31
|
+
import type { RemoveActionsMenuKeyFromRemotePlayerEvent } from "./RemoveActionsMenuKeyFromRemotePlayerEvent";
|
|
28
32
|
export interface TypedMessageEvent<T> extends MessageEvent {
|
|
29
33
|
data: T;
|
|
30
34
|
}
|
|
@@ -32,6 +36,8 @@ export interface TypedMessageEvent<T> extends MessageEvent {
|
|
|
32
36
|
* List event types sent from an iFrame to WorkAdventure
|
|
33
37
|
*/
|
|
34
38
|
export declare type IframeEventMap = {
|
|
39
|
+
addActionsMenuKeyToRemotePlayer: AddActionsMenuKeyToRemotePlayerEvent;
|
|
40
|
+
removeActionsMenuKeyFromRemotePlayer: RemoveActionsMenuKeyFromRemotePlayerEvent;
|
|
35
41
|
loadPage: LoadPageEvent;
|
|
36
42
|
chat: ChatEvent;
|
|
37
43
|
cameraFollowPlayer: CameraFollowPlayerEvent;
|
|
@@ -45,6 +51,7 @@ export declare type IframeEventMap = {
|
|
|
45
51
|
displayBubble: null;
|
|
46
52
|
removeBubble: null;
|
|
47
53
|
onPlayerMove: undefined;
|
|
54
|
+
onOpenActionMenu: undefined;
|
|
48
55
|
onCameraUpdate: undefined;
|
|
49
56
|
showLayer: LayerEvent;
|
|
50
57
|
hideLayer: LayerEvent;
|
|
@@ -73,6 +80,8 @@ export interface IframeResponseEventMap {
|
|
|
73
80
|
enterZoneEvent: ChangeZoneEvent;
|
|
74
81
|
leaveZoneEvent: ChangeZoneEvent;
|
|
75
82
|
buttonClickedEvent: ButtonClickedEvent;
|
|
83
|
+
remotePlayerClickedEvent: RemotePlayerClickedEvent;
|
|
84
|
+
actionsMenuActionClickedEvent: ActionsMenuActionClickedEvent;
|
|
76
85
|
hasPlayerMoved: HasPlayerMovedEvent;
|
|
77
86
|
wasCameraUpdated: WasCameraUpdatedEvent;
|
|
78
87
|
menuItemClicked: MenuItemClickedEvent;
|
|
@@ -259,9 +268,9 @@ export interface IframeQueryWrapper<T extends keyof IframeQueryMap> {
|
|
|
259
268
|
id: number;
|
|
260
269
|
query: IframeQuery<T>;
|
|
261
270
|
}
|
|
262
|
-
export declare const isIframeQueryKey: (type: string) => type is "
|
|
263
|
-
export declare const isIframeQuery: (event: any) => event is IframeQuery<"
|
|
264
|
-
export declare const isIframeQueryWrapper: (event: any) => event is IframeQueryWrapper<"
|
|
271
|
+
export declare const isIframeQueryKey: (type: string) => type is "setVariable" | "getState" | "loadTileset" | "getMapData" | "openCoWebsite" | "getCoWebsites" | "closeCoWebsite" | "closeCoWebsites" | "triggerActionMessage" | "removeActionMessage" | "getEmbeddedWebsite" | "deleteEmbeddedWebsite" | "createEmbeddedWebsite" | "setPlayerOutline" | "removePlayerOutline" | "getPlayerPosition" | "movePlayerTo";
|
|
272
|
+
export declare const isIframeQuery: (event: any) => event is IframeQuery<"setVariable" | "getState" | "loadTileset" | "getMapData" | "openCoWebsite" | "getCoWebsites" | "closeCoWebsite" | "closeCoWebsites" | "triggerActionMessage" | "removeActionMessage" | "getEmbeddedWebsite" | "deleteEmbeddedWebsite" | "createEmbeddedWebsite" | "setPlayerOutline" | "removePlayerOutline" | "getPlayerPosition" | "movePlayerTo">;
|
|
273
|
+
export declare const isIframeQueryWrapper: (event: any) => event is IframeQueryWrapper<"setVariable" | "getState" | "loadTileset" | "getMapData" | "openCoWebsite" | "getCoWebsites" | "closeCoWebsite" | "closeCoWebsites" | "triggerActionMessage" | "removeActionMessage" | "getEmbeddedWebsite" | "deleteEmbeddedWebsite" | "createEmbeddedWebsite" | "setPlayerOutline" | "removePlayerOutline" | "getPlayerPosition" | "movePlayerTo">;
|
|
265
274
|
export interface IframeAnswerEvent<T extends keyof IframeQueryMap> {
|
|
266
275
|
id: number;
|
|
267
276
|
type: T;
|
|
@@ -270,7 +279,7 @@ export interface IframeAnswerEvent<T extends keyof IframeQueryMap> {
|
|
|
270
279
|
export declare const isIframeAnswerEvent: (event: {
|
|
271
280
|
type?: string;
|
|
272
281
|
id?: number;
|
|
273
|
-
}) => event is IframeAnswerEvent<"
|
|
282
|
+
}) => event is IframeAnswerEvent<"setVariable" | "getState" | "loadTileset" | "getMapData" | "openCoWebsite" | "getCoWebsites" | "closeCoWebsite" | "closeCoWebsites" | "triggerActionMessage" | "removeActionMessage" | "getEmbeddedWebsite" | "deleteEmbeddedWebsite" | "createEmbeddedWebsite" | "setPlayerOutline" | "removePlayerOutline" | "getPlayerPosition" | "movePlayerTo">;
|
|
274
283
|
export interface IframeErrorAnswerEvent {
|
|
275
284
|
id: number;
|
|
276
285
|
type: keyof IframeQueryMap;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as tg from "generic-type-guard";
|
|
2
|
+
export declare const isRemotePlayerClickedEvent: tg.TypeGuard<object & {
|
|
3
|
+
id: number;
|
|
4
|
+
}>;
|
|
5
|
+
/**
|
|
6
|
+
* A message sent from the game to the iFrame when RemotePlayer is clicked.
|
|
7
|
+
*/
|
|
8
|
+
export declare type RemotePlayerClickedEvent = tg.GuardedType<typeof isRemotePlayerClickedEvent>;
|
|
9
|
+
export declare type RemotePlayerClickedEventCallback = (event: RemotePlayerClickedEvent) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as tg from "generic-type-guard";
|
|
2
|
+
export declare const isRemoveActionsMenuKeyFromRemotePlayerEvent: tg.TypeGuard<object & {
|
|
3
|
+
id: number;
|
|
4
|
+
actionKey: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare type RemoveActionsMenuKeyFromRemotePlayerEvent = tg.GuardedType<typeof isRemoveActionsMenuKeyFromRemotePlayerEvent>;
|
|
7
|
+
export declare type RemoveActionsMenuKeyFromRemotePlayerEventCallback = (event: RemoveActionsMenuKeyFromRemotePlayerEvent) => void;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,6 +4,7 @@ import { Popup } from "./Ui/Popup";
|
|
|
4
4
|
import { ActionMessage } from "./Ui/ActionMessage";
|
|
5
5
|
import { Menu } from "./Ui/Menu";
|
|
6
6
|
import type { RequireOnlyOne } from "../types";
|
|
7
|
+
import { Observable, Subject } from "rxjs";
|
|
7
8
|
interface MenuDescriptor {
|
|
8
9
|
callback?: (commandDescriptor: string) => void;
|
|
9
10
|
iframe?: string;
|
|
@@ -15,8 +16,33 @@ export interface ActionMessageOptions {
|
|
|
15
16
|
type?: "message" | "warning";
|
|
16
17
|
callback: () => void;
|
|
17
18
|
}
|
|
19
|
+
export interface RemotePlayerInterface {
|
|
20
|
+
addAction(key: string, callback: Function): void;
|
|
21
|
+
}
|
|
22
|
+
export declare class RemotePlayer implements RemotePlayerInterface {
|
|
23
|
+
private id;
|
|
24
|
+
private actions;
|
|
25
|
+
constructor(id: number);
|
|
26
|
+
addAction(key: string, callback: Function): ActionsMenuAction;
|
|
27
|
+
callAction(key: string): void;
|
|
28
|
+
removeAction(key: string): void;
|
|
29
|
+
}
|
|
30
|
+
export declare class ActionsMenuAction {
|
|
31
|
+
private remotePlayer;
|
|
32
|
+
private key;
|
|
33
|
+
private callback;
|
|
34
|
+
constructor(remotePlayer: RemotePlayer, key: string, callback: Function);
|
|
35
|
+
call(): void;
|
|
36
|
+
remove(): void;
|
|
37
|
+
}
|
|
18
38
|
export declare class WorkAdventureUiCommands extends IframeApiContribution<WorkAdventureUiCommands> {
|
|
39
|
+
readonly _onRemotePlayerClicked: Subject<RemotePlayerInterface>;
|
|
40
|
+
readonly onRemotePlayerClicked: Observable<RemotePlayerInterface>;
|
|
41
|
+
private currentlyClickedRemotePlayer?;
|
|
42
|
+
constructor();
|
|
19
43
|
callbacks: import("./IframeApiContribution").IframeCallbackContribution<keyof import("../Events/IframeEvent").IframeResponseEventMap>[];
|
|
44
|
+
addActionsMenuKeyToRemotePlayer(id: number, actionKey: string): void;
|
|
45
|
+
removeActionsMenuKeyFromRemotePlayer(id: number, actionKey: string): void;
|
|
20
46
|
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
|
|
21
47
|
registerMenuCommand(commandDescriptor: string, options: MenuOptions | ((commandDescriptor: string) => void)): Menu;
|
|
22
48
|
displayBubble(): void;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/// <reference types="phaser" />
|
|
2
|
+
/**
|
|
3
|
+
* Tiled Map Interface
|
|
4
|
+
*
|
|
5
|
+
* Represents the interface for the Tiled exported data structure (JSON). Used
|
|
6
|
+
* when loading resources via Resource loader.
|
|
7
|
+
*/
|
|
8
|
+
import TilemapLayer = Phaser.Tilemaps.TilemapLayer;
|
|
9
|
+
export interface ITiledMap {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
layers: ITiledMapLayer[];
|
|
13
|
+
nextobjectid: number;
|
|
14
|
+
/**
|
|
15
|
+
* Map orientation (orthogonal)
|
|
16
|
+
*/
|
|
17
|
+
orientation: string;
|
|
18
|
+
properties?: ITiledMapProperty[];
|
|
19
|
+
/**
|
|
20
|
+
* Render order (right-down)
|
|
21
|
+
*/
|
|
22
|
+
renderorder: string;
|
|
23
|
+
tileheight: number;
|
|
24
|
+
tilewidth: number;
|
|
25
|
+
tilesets: ITiledTileSet[];
|
|
26
|
+
version: number;
|
|
27
|
+
compressionlevel?: number;
|
|
28
|
+
infinite?: boolean;
|
|
29
|
+
nextlayerid?: number;
|
|
30
|
+
tiledversion?: string;
|
|
31
|
+
type?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ITiledMapProperty {
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
value: string | boolean | number | undefined;
|
|
37
|
+
}
|
|
38
|
+
export declare type ITiledMapLayer = ITiledMapGroupLayer | ITiledMapObjectLayer | ITiledMapTileLayer;
|
|
39
|
+
export interface ITiledMapGroupLayer {
|
|
40
|
+
id?: number;
|
|
41
|
+
name: string;
|
|
42
|
+
opacity: number;
|
|
43
|
+
properties?: ITiledMapProperty[];
|
|
44
|
+
type: "group";
|
|
45
|
+
visible: boolean;
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
/**
|
|
49
|
+
* Layers for group layer
|
|
50
|
+
*/
|
|
51
|
+
layers: ITiledMapLayer[];
|
|
52
|
+
}
|
|
53
|
+
export interface ITiledMapTileLayer {
|
|
54
|
+
id?: number;
|
|
55
|
+
data: number[] | string;
|
|
56
|
+
height: number;
|
|
57
|
+
name: string;
|
|
58
|
+
opacity: number;
|
|
59
|
+
properties?: ITiledMapProperty[];
|
|
60
|
+
encoding?: string;
|
|
61
|
+
compression?: string;
|
|
62
|
+
type: "tilelayer";
|
|
63
|
+
visible: boolean;
|
|
64
|
+
width: number;
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
parallaxx?: number;
|
|
68
|
+
parallaxy?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Draw order (topdown (default), index)
|
|
71
|
+
*/
|
|
72
|
+
draworder?: string;
|
|
73
|
+
phaserLayer?: TilemapLayer;
|
|
74
|
+
}
|
|
75
|
+
export interface ITiledMapObjectLayer {
|
|
76
|
+
id?: number;
|
|
77
|
+
height: number;
|
|
78
|
+
name: string;
|
|
79
|
+
opacity: number;
|
|
80
|
+
properties?: ITiledMapProperty[];
|
|
81
|
+
encoding?: string;
|
|
82
|
+
compression?: string;
|
|
83
|
+
type: "objectgroup";
|
|
84
|
+
visible: boolean;
|
|
85
|
+
width: number;
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
/**
|
|
89
|
+
* Draw order (topdown (default), index)
|
|
90
|
+
*/
|
|
91
|
+
draworder?: string;
|
|
92
|
+
objects: ITiledMapObject[];
|
|
93
|
+
}
|
|
94
|
+
export interface ITiledMapObject {
|
|
95
|
+
id: number;
|
|
96
|
+
/**
|
|
97
|
+
* Tile object id
|
|
98
|
+
*/
|
|
99
|
+
gid: number;
|
|
100
|
+
height: number;
|
|
101
|
+
name: string;
|
|
102
|
+
properties?: ITiledMapProperty[];
|
|
103
|
+
rotation: number;
|
|
104
|
+
type: string;
|
|
105
|
+
visible: boolean;
|
|
106
|
+
width: number;
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
/**
|
|
110
|
+
* Whether or not object is an ellipse
|
|
111
|
+
*/
|
|
112
|
+
ellipse: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Polygon points
|
|
115
|
+
*/
|
|
116
|
+
polygon: {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
}[];
|
|
120
|
+
/**
|
|
121
|
+
* Polyline points
|
|
122
|
+
*/
|
|
123
|
+
polyline: {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
}[];
|
|
127
|
+
text?: ITiledText;
|
|
128
|
+
template?: string;
|
|
129
|
+
}
|
|
130
|
+
export interface ITiledText {
|
|
131
|
+
text: string;
|
|
132
|
+
wrap?: boolean;
|
|
133
|
+
fontfamily?: string;
|
|
134
|
+
pixelsize?: number;
|
|
135
|
+
color?: string;
|
|
136
|
+
underline?: boolean;
|
|
137
|
+
italic?: boolean;
|
|
138
|
+
strikeout?: boolean;
|
|
139
|
+
halign?: "center" | "right" | "justify" | "left";
|
|
140
|
+
}
|
|
141
|
+
export interface ITiledTileSet {
|
|
142
|
+
firstgid: number;
|
|
143
|
+
image: string;
|
|
144
|
+
imageheight: number;
|
|
145
|
+
imagewidth: number;
|
|
146
|
+
columns: number;
|
|
147
|
+
margin: number;
|
|
148
|
+
name: string;
|
|
149
|
+
properties?: ITiledMapProperty[];
|
|
150
|
+
spacing: number;
|
|
151
|
+
tilecount: number;
|
|
152
|
+
tileheight: number;
|
|
153
|
+
tilewidth: number;
|
|
154
|
+
transparentcolor: string;
|
|
155
|
+
terrains: ITiledMapTerrain[];
|
|
156
|
+
tiles?: Array<ITile>;
|
|
157
|
+
/**
|
|
158
|
+
* Refers to external tileset file (should be JSON)
|
|
159
|
+
*/
|
|
160
|
+
source: string;
|
|
161
|
+
}
|
|
162
|
+
export interface ITile {
|
|
163
|
+
id: number;
|
|
164
|
+
type?: string;
|
|
165
|
+
properties?: ITiledMapProperty[];
|
|
166
|
+
}
|
|
167
|
+
export interface ITiledMapTerrain {
|
|
168
|
+
name: string;
|
|
169
|
+
tile: number;
|
|
170
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as tg from "generic-type-guard";
|
|
2
|
-
export declare const isCloseCoWebsite: tg.TypeGuard<object & {
|
|
3
|
-
id: string | undefined;
|
|
4
|
-
}>;
|
|
5
|
-
/**
|
|
6
|
-
* A message sent from the iFrame to the game to add a message in the chat.
|
|
7
|
-
*/
|
|
8
|
-
export declare type CloseCoWebsiteEvent = tg.GuardedType<typeof isCloseCoWebsite>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as tg from "generic-type-guard";
|
|
2
|
-
export declare const isTriggerMessageHandlerEvent: tg.PartialTypeGuard<unknown, (object & {
|
|
3
|
-
type: "triggerActionMessage";
|
|
4
|
-
data: object & {
|
|
5
|
-
message: string;
|
|
6
|
-
uuid: string;
|
|
7
|
-
type: "message" | "warning";
|
|
8
|
-
};
|
|
9
|
-
}) | (object & {
|
|
10
|
-
type: "removeActionMessage";
|
|
11
|
-
data: object & {
|
|
12
|
-
uuid: string;
|
|
13
|
-
};
|
|
14
|
-
})>;
|
package/Api/IframeListener.d.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { IframeQueryMap, IframeResponseEvent, IframeResponseEventMap } from "./Events/IframeEvent";
|
|
2
|
-
import type { HasPlayerMovedEvent } from "./Events/HasPlayerMovedEvent";
|
|
3
|
-
import type { SetVariableEvent } from "./Events/SetVariableEvent";
|
|
4
|
-
import type { WasCameraUpdatedEvent } from "./Events/WasCameraUpdatedEvent";
|
|
5
|
-
declare type AnswererCallback<T extends keyof IframeQueryMap> = (query: IframeQueryMap[T]["query"], source: MessageEventSource | null) => IframeQueryMap[T]["answer"] | PromiseLike<IframeQueryMap[T]["answer"]>;
|
|
6
|
-
/**
|
|
7
|
-
* Listens to messages from iframes and turn those messages into easy to use observables.
|
|
8
|
-
* Also allows to send messages to those iframes.
|
|
9
|
-
*/
|
|
10
|
-
declare class IframeListener {
|
|
11
|
-
private readonly _openPopupStream;
|
|
12
|
-
readonly openPopupStream: import("rxjs").Observable<object & {
|
|
13
|
-
popupId: number;
|
|
14
|
-
targetObject: string;
|
|
15
|
-
message: string;
|
|
16
|
-
buttons: (object & {
|
|
17
|
-
label: string;
|
|
18
|
-
className: string | undefined;
|
|
19
|
-
})[];
|
|
20
|
-
}>;
|
|
21
|
-
private readonly _openTabStream;
|
|
22
|
-
readonly openTabStream: import("rxjs").Observable<object & {
|
|
23
|
-
url: string;
|
|
24
|
-
}>;
|
|
25
|
-
private readonly _loadPageStream;
|
|
26
|
-
readonly loadPageStream: import("rxjs").Observable<string>;
|
|
27
|
-
private readonly _disablePlayerControlStream;
|
|
28
|
-
readonly disablePlayerControlStream: import("rxjs").Observable<void>;
|
|
29
|
-
private readonly _cameraSetStream;
|
|
30
|
-
readonly cameraSetStream: import("rxjs").Observable<object & {
|
|
31
|
-
x: number;
|
|
32
|
-
y: number;
|
|
33
|
-
width: number | undefined;
|
|
34
|
-
height: number | undefined;
|
|
35
|
-
lock: boolean;
|
|
36
|
-
smooth: boolean;
|
|
37
|
-
}>;
|
|
38
|
-
private readonly _cameraFollowPlayerStream;
|
|
39
|
-
readonly cameraFollowPlayerStream: import("rxjs").Observable<object & {
|
|
40
|
-
smooth: boolean;
|
|
41
|
-
}>;
|
|
42
|
-
private readonly _enablePlayerControlStream;
|
|
43
|
-
readonly enablePlayerControlStream: import("rxjs").Observable<void>;
|
|
44
|
-
private readonly _closePopupStream;
|
|
45
|
-
readonly closePopupStream: import("rxjs").Observable<object & {
|
|
46
|
-
popupId: number;
|
|
47
|
-
}>;
|
|
48
|
-
private readonly _displayBubbleStream;
|
|
49
|
-
readonly displayBubbleStream: import("rxjs").Observable<void>;
|
|
50
|
-
private readonly _removeBubbleStream;
|
|
51
|
-
readonly removeBubbleStream: import("rxjs").Observable<void>;
|
|
52
|
-
private readonly _showLayerStream;
|
|
53
|
-
readonly showLayerStream: import("rxjs").Observable<object & {
|
|
54
|
-
name: string;
|
|
55
|
-
}>;
|
|
56
|
-
private readonly _hideLayerStream;
|
|
57
|
-
readonly hideLayerStream: import("rxjs").Observable<object & {
|
|
58
|
-
name: string;
|
|
59
|
-
}>;
|
|
60
|
-
private readonly _setPropertyStream;
|
|
61
|
-
readonly setPropertyStream: import("rxjs").Observable<object & {
|
|
62
|
-
layerName: string;
|
|
63
|
-
propertyName: string;
|
|
64
|
-
propertyValue: string | number | boolean | undefined;
|
|
65
|
-
}>;
|
|
66
|
-
private readonly _playSoundStream;
|
|
67
|
-
readonly playSoundStream: import("rxjs").Observable<object & {
|
|
68
|
-
url: string;
|
|
69
|
-
config: (object & {
|
|
70
|
-
volume: number | undefined;
|
|
71
|
-
loop: boolean | undefined;
|
|
72
|
-
mute: boolean | undefined;
|
|
73
|
-
rate: number | undefined;
|
|
74
|
-
detune: number | undefined;
|
|
75
|
-
seek: number | undefined;
|
|
76
|
-
delay: number | undefined;
|
|
77
|
-
}) | undefined;
|
|
78
|
-
}>;
|
|
79
|
-
private readonly _stopSoundStream;
|
|
80
|
-
readonly stopSoundStream: import("rxjs").Observable<object & {
|
|
81
|
-
url: string;
|
|
82
|
-
}>;
|
|
83
|
-
private readonly _loadSoundStream;
|
|
84
|
-
readonly loadSoundStream: import("rxjs").Observable<object & {
|
|
85
|
-
url: string;
|
|
86
|
-
}>;
|
|
87
|
-
private readonly _trackCameraUpdateStream;
|
|
88
|
-
readonly trackCameraUpdateStream: import("rxjs").Observable<object & {
|
|
89
|
-
url: string;
|
|
90
|
-
}>;
|
|
91
|
-
private readonly _setTilesStream;
|
|
92
|
-
readonly setTilesStream: import("rxjs").Observable<(object & {
|
|
93
|
-
x: number;
|
|
94
|
-
y: number;
|
|
95
|
-
tile: string | number | null;
|
|
96
|
-
layer: string;
|
|
97
|
-
})[]>;
|
|
98
|
-
private readonly _modifyEmbeddedWebsiteStream;
|
|
99
|
-
readonly modifyEmbeddedWebsiteStream: import("rxjs").Observable<object & {
|
|
100
|
-
name: string;
|
|
101
|
-
} & Partial<{
|
|
102
|
-
url: string;
|
|
103
|
-
visible: boolean;
|
|
104
|
-
allowApi: boolean;
|
|
105
|
-
allow: string;
|
|
106
|
-
x: number;
|
|
107
|
-
y: number;
|
|
108
|
-
width: number;
|
|
109
|
-
height: number;
|
|
110
|
-
origin: "player" | "map";
|
|
111
|
-
scale: number;
|
|
112
|
-
}>>;
|
|
113
|
-
private readonly iframes;
|
|
114
|
-
private readonly iframeCloseCallbacks;
|
|
115
|
-
private readonly scripts;
|
|
116
|
-
private sendPlayerMove;
|
|
117
|
-
private answerers;
|
|
118
|
-
init(): void;
|
|
119
|
-
/**
|
|
120
|
-
* Allows the passed iFrame to send/receive messages via the API.
|
|
121
|
-
*/
|
|
122
|
-
registerIframe(iframe: HTMLIFrameElement): void;
|
|
123
|
-
unregisterIframe(iframe: HTMLIFrameElement): void;
|
|
124
|
-
registerScript(scriptUrl: string, enableModuleMode?: boolean): Promise<void>;
|
|
125
|
-
private getBaseUrl;
|
|
126
|
-
getBaseUrlFromSource(source: MessageEventSource): string;
|
|
127
|
-
private static getIFrameId;
|
|
128
|
-
unregisterScript(scriptUrl: string): void;
|
|
129
|
-
sendUserInputChat(message: string): void;
|
|
130
|
-
sendEnterEvent(name: string): void;
|
|
131
|
-
sendLeaveEvent(name: string): void;
|
|
132
|
-
sendEnterLayerEvent(layerName: string): void;
|
|
133
|
-
sendLeaveLayerEvent(layerName: string): void;
|
|
134
|
-
sendEnterZoneEvent(zoneName: string): void;
|
|
135
|
-
sendLeaveZoneEvent(zoneName: string): void;
|
|
136
|
-
hasPlayerMoved(event: HasPlayerMovedEvent): void;
|
|
137
|
-
sendCameraUpdated(event: WasCameraUpdatedEvent): void;
|
|
138
|
-
sendButtonClickedEvent(popupId: number, buttonId: number): void;
|
|
139
|
-
setVariable(setVariableEvent: SetVariableEvent): void;
|
|
140
|
-
sendActionMessageTriggered(uuid: string): void;
|
|
141
|
-
/**
|
|
142
|
-
* Sends the message... to all allowed iframes.
|
|
143
|
-
*/
|
|
144
|
-
postMessage(message: IframeResponseEvent<keyof IframeResponseEventMap>): void;
|
|
145
|
-
/**
|
|
146
|
-
* Registers a callback that can be used to respond to some query (as defined in the IframeQueryMap type).
|
|
147
|
-
*
|
|
148
|
-
* Important! There can be only one "answerer" so registering a new one will unregister the old one.
|
|
149
|
-
*
|
|
150
|
-
* @param key The "type" of the query we are answering
|
|
151
|
-
* @param callback
|
|
152
|
-
*/
|
|
153
|
-
registerAnswerer<T extends keyof IframeQueryMap>(key: T, callback: AnswererCallback<T>): void;
|
|
154
|
-
unregisterAnswerer(key: keyof IframeQueryMap): void;
|
|
155
|
-
dispatchVariableToOtherIframes(key: string, value: unknown, source: MessageEventSource | null): void;
|
|
156
|
-
}
|
|
157
|
-
export declare const iframeListener: IframeListener;
|
|
158
|
-
export {};
|
package/Api/ScriptUtils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sendMenuClickedEvent(menuItem: string): void;
|