diff options
author | jbion <joffrey.bion@amadeus.com> | 2019-02-22 23:09:40 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2019-02-22 23:09:40 +0100 |
commit | 27990fcba5a47252df617db1bc98e2276b326e7e (patch) | |
tree | 7fba886ae83379ee9d76e6540efae7b0e7ce2a25 /frontend/src/models | |
parent | Fix websocket value when no message body is received (diff) | |
download | seven-wonders-27990fcba5a47252df617db1bc98e2276b326e7e.tar.gz seven-wonders-27990fcba5a47252df617db1bc98e2276b326e7e.tar.bz2 seven-wonders-27990fcba5a47252df617db1bc98e2276b326e7e.zip |
Implement Game start
Diffstat (limited to 'frontend/src/models')
-rw-r--r-- | frontend/src/models/currentGame.js | 6 | ||||
-rw-r--r-- | frontend/src/models/games.js | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/frontend/src/models/currentGame.js b/frontend/src/models/currentGame.js new file mode 100644 index 00000000..fcabe875 --- /dev/null +++ b/frontend/src/models/currentGame.js @@ -0,0 +1,6 @@ +import type { ApiPlayerTurnInfo } from '../api/model'; + +export class CurrentGameState { + playersReadiness: Map<string, boolean> = new Map(); + turnInfo: ApiPlayerTurnInfo | null = null +} diff --git a/frontend/src/models/games.js b/frontend/src/models/games.js index 7a8dfbc7..85aab2df 100644 --- a/frontend/src/models/games.js +++ b/frontend/src/models/games.js @@ -15,6 +15,7 @@ export type SettingsShape = { wonderSidePickMethod: "EACH_RANDOM" | "TODO", pointsPer3Gold: number }; + export type SettingsType = Record<SettingsShape>; const SettingsRecord: SettingsType = Record({ @@ -32,6 +33,7 @@ const SettingsRecord: SettingsType = Record({ wonderSidePickMethod: 'EACH_RANDOM', pointsPer3Gold: 1, }); + export class Settings extends SettingsRecord {} export type GameState = 'LOBBY' | 'PLAYING'; @@ -43,6 +45,7 @@ export type GameShape = { settings: SettingsType, state: GameState, }; + export type GameType = Record<GameShape>; export type GameMapType = Map<string, GameShape>; export type GameNormalMapType = { [string]: GameShape }; @@ -55,18 +58,21 @@ const GameRecord: GameType = Record({ settings: new Settings(), state: 'LOBBY', }); + export class Game extends GameRecord {} export type GamesShape = { all: Map<Game>, current: string }; + export type GamesType = Record<GamesShape>; const GamesRecord: GamesType = Record({ all: new Map(), current: null, }); + export class GamesState extends GamesRecord { addGame(g: GameShape) { const game: Game = new Game(g); |