2021-04-21 15:51:01 +02:00
|
|
|
import * as tg from "generic-type-guard";
|
|
|
|
|
2021-06-25 18:14:40 +02:00
|
|
|
export const isGameStateEvent = new tg.IsInterface()
|
|
|
|
.withProperties({
|
|
|
|
roomId: tg.isString,
|
|
|
|
mapUrl: tg.isString,
|
2021-07-05 11:53:33 +02:00
|
|
|
nickname: tg.isString,
|
2021-06-25 18:14:40 +02:00
|
|
|
uuid: tg.isUnion(tg.isString, tg.isUndefined),
|
|
|
|
startLayerName: tg.isUnion(tg.isString, tg.isNull),
|
|
|
|
tags: tg.isArray(tg.isString),
|
2021-07-05 11:53:33 +02:00
|
|
|
variables: tg.isObject,
|
2021-06-25 18:14:40 +02:00
|
|
|
})
|
|
|
|
.get();
|
2021-04-21 15:51:01 +02:00
|
|
|
/**
|
2021-05-25 11:02:25 +02:00
|
|
|
* A message sent from the game to the iFrame when the gameState is received by the script
|
2021-04-21 15:51:01 +02:00
|
|
|
*/
|
2021-05-25 11:02:25 +02:00
|
|
|
export type GameStateEvent = tg.GuardedType<typeof isGameStateEvent>;
|