Merge branch 'develop' of github.com:thecodingmachine/workadventure into jonnytest1-tiles-start-positions

This commit is contained in:
GRL 2021-07-02 14:35:28 +02:00
commit e1611969ce
62 changed files with 1215 additions and 218 deletions

View file

@ -17,14 +17,13 @@ import type { PlaySoundEvent } from "./PlaySoundEvent";
import type { MenuItemClickedEvent } from "./ui/MenuItemClickedEvent";
import type { MenuItemRegisterEvent } from "./ui/MenuItemRegisterEvent";
import type { HasPlayerMovedEvent } from "./HasPlayerMovedEvent";
import type { SetTilesEvent } from "./SetTilesEvent";
export interface TypedMessageEvent<T> extends MessageEvent {
data: T;
}
export type IframeEventMap = {
//getState: GameStateEvent,
// updateTile: UpdateTileEvent
loadPage: LoadPageEvent;
chat: ChatEvent;
openPopup: OpenPopupEvent;
@ -47,6 +46,7 @@ export type IframeEventMap = {
stopSound: null;
getState: undefined;
registerMenuCommand: MenuItemRegisterEvent;
setTiles: SetTilesEvent;
};
export interface IframeEvent<T extends keyof IframeEventMap> {
type: T;

View file

@ -1,11 +1,12 @@
import * as tg from "generic-type-guard";
export const isOpenCoWebsite =
new tg.IsInterface().withProperties({
export const isOpenCoWebsite = new tg.IsInterface()
.withProperties({
url: tg.isString,
}).get();
allowApi: tg.isBoolean,
allowPolicy: tg.isString,
})
.get();
/**
* A message sent from the iFrame to the game to add a message in the chat.

View file

@ -0,0 +1,16 @@
import * as tg from "generic-type-guard";
export const isSetTilesEvent = tg.isArray(
new tg.IsInterface()
.withProperties({
x: tg.isNumber,
y: tg.isNumber,
tile: tg.isUnion(tg.isNumber, tg.isString),
layer: tg.isString,
})
.get()
);
/**
* A message sent from the iFrame to the game to set one or many tiles.
*/
export type SetTilesEvent = tg.GuardedType<typeof isSetTilesEvent>;