2021-04-21 15:51:01 +02:00
|
|
|
import * as tg from "generic-type-guard";
|
|
|
|
|
2021-05-18 11:33:16 +02:00
|
|
|
/*export const isPositionState = new tg.IsInterface().withProperties({
|
2021-05-01 19:44:14 +02:00
|
|
|
x: tg.isNumber,
|
|
|
|
y: tg.isNumber
|
|
|
|
}).get()
|
|
|
|
export const isPlayerState = new tg.IsInterface()
|
|
|
|
.withStringIndexSignature(
|
|
|
|
new tg.IsInterface().withProperties({
|
|
|
|
position: isPositionState,
|
|
|
|
pusherId: tg.isUnion(tg.isNumber, tg.isUndefined)
|
|
|
|
}).get()
|
|
|
|
).get()
|
|
|
|
|
2021-05-18 11:33:16 +02:00
|
|
|
export type PlayerStateObject = tg.GuardedType<typeof isPlayerState>;*/
|
2021-05-01 19:44:14 +02:00
|
|
|
|
2021-04-21 15:51:01 +02:00
|
|
|
export const isGameStateEvent =
|
|
|
|
new tg.IsInterface().withProperties({
|
|
|
|
roomId: tg.isString,
|
2021-05-01 19:44:14 +02:00
|
|
|
mapUrl: tg.isString,
|
2021-05-18 15:41:16 +02:00
|
|
|
nickname: tg.isUnion(tg.isString, tg.isNull),
|
2021-05-01 19:44:14 +02:00
|
|
|
uuid: tg.isUnion(tg.isString, tg.isUndefined),
|
|
|
|
startLayerName: tg.isUnion(tg.isString, tg.isNull)
|
2021-04-21 15:51:01 +02:00
|
|
|
}).get();
|
|
|
|
/**
|
2021-05-18 11:33:16 +02:00
|
|
|
* A message sent from the game to the iFrame when the gameState is got by the script
|
2021-04-21 15:51:01 +02:00
|
|
|
*/
|
|
|
|
export type GameStateEvent = tg.GuardedType<typeof isGameStateEvent>;
|