implementation of DataLayerEvent
update GetGameState to add nickname to the returned data update GameMap to separate phaserLayer and mapLayer
This commit is contained in:
parent
201fcf6afa
commit
aa78bf44ef
10 changed files with 94 additions and 67 deletions
|
@ -2,7 +2,7 @@ import * as tg from "generic-type-guard";
|
|||
|
||||
|
||||
|
||||
export const isHasDataLayerChangedEvent =
|
||||
export const isDataLayerEvent =
|
||||
new tg.IsInterface().withProperties({
|
||||
data: tg.isObject
|
||||
}).get();
|
||||
|
@ -10,7 +10,4 @@ export const isHasDataLayerChangedEvent =
|
|||
/**
|
||||
* A message sent from the game to the iFrame when the data of the layers change after the iFrame send a message to the game that it want to listen to the data of the layers
|
||||
*/
|
||||
export type DataLayerEvent = tg.GuardedType<typeof isHasDataLayerChangedEvent>;
|
||||
|
||||
|
||||
export type HasDataLayerChangedEventCallback = (event: DataLayerEvent) => void
|
||||
export type DataLayerEvent = tg.GuardedType<typeof isDataLayerEvent>;
|
|
@ -18,6 +18,7 @@ export const isGameStateEvent =
|
|||
new tg.IsInterface().withProperties({
|
||||
roomId: tg.isString,
|
||||
mapUrl: tg.isString,
|
||||
nickname: tg.isUnion(tg.isString, tg.isNull),
|
||||
uuid: tg.isUnion(tg.isString, tg.isUndefined),
|
||||
startLayerName: tg.isUnion(tg.isString, tg.isNull)
|
||||
}).get();
|
||||
|
|
|
@ -10,7 +10,7 @@ import type { OpenCoWebSiteEvent } from './OpenCoWebSiteEvent';
|
|||
import type { OpenPopupEvent } from './OpenPopupEvent';
|
||||
import type { OpenTabEvent } from './OpenTabEvent';
|
||||
import type { UserInputChatEvent } from './UserInputChatEvent';
|
||||
import type { HasDataLayerChangedEvent } from "./HasDataLayerChangedEvent";
|
||||
import type { DataLayerEvent } from "./DataLayerEvent";
|
||||
import type { LayerEvent } from './LayerEvent';
|
||||
import type { SetPropertyEvent } from "./setPropertyEvent";
|
||||
|
||||
|
@ -37,6 +37,7 @@ export type IframeEventMap = {
|
|||
showLayer: LayerEvent
|
||||
hideLayer: LayerEvent
|
||||
setProperty: SetPropertyEvent
|
||||
getDataLayer: undefined
|
||||
}
|
||||
export interface IframeEvent<T extends keyof IframeEventMap> {
|
||||
type: T;
|
||||
|
@ -54,7 +55,7 @@ export interface IframeResponseEventMap {
|
|||
buttonClickedEvent: ButtonClickedEvent
|
||||
gameState: GameStateEvent
|
||||
hasPlayerMoved: HasPlayerMovedEvent
|
||||
hasDataLayerChanged: HasDataLayerChangedEvent
|
||||
dataLayer: DataLayerEvent
|
||||
}
|
||||
export interface IframeResponseEvent<T extends keyof IframeResponseEventMap> {
|
||||
type: T;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue