From f3971a4b28de1ecfd0fb1ab92f9c090ce6273d2b Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Mon, 29 Jan 2024 22:11:56 -0600 Subject: [PATCH] start work on game view --- site/components.d.ts | 5 +++ site/src/App.vue | 3 +- site/src/components/Game.vue | 38 +++++++++++++++++++ site/src/components/GameStatus.vue | 27 ++++++++++++++ site/src/components/Player.vue | 21 +++++++++++ site/src/components/PlayerHP.vue | 17 +++++++++ site/src/lib/game.ts | 59 ++++++++++++++++++++++++++++++ 7 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 site/src/components/Game.vue create mode 100644 site/src/components/GameStatus.vue create mode 100644 site/src/components/Player.vue create mode 100644 site/src/components/PlayerHP.vue create mode 100644 site/src/lib/game.ts diff --git a/site/components.d.ts b/site/components.d.ts index 038c980..fbaebea 100644 --- a/site/components.d.ts +++ b/site/components.d.ts @@ -7,7 +7,12 @@ export {} declare module 'vue' { export interface GlobalComponents { + Game: typeof import('./src/components/Game.vue')['default'] + GameRound: typeof import('./src/components/GameRound.vue')['default'] + GameStatus: typeof import('./src/components/GameStatus.vue')['default'] HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] + Player: typeof import('./src/components/Player.vue')['default'] + PlayerHP: typeof import('./src/components/PlayerHP.vue')['default'] TheLanding: typeof import('./src/components/TheLanding.vue')['default'] } } diff --git a/site/src/App.vue b/site/src/App.vue index e0fe440..01e8c14 100644 --- a/site/src/App.vue +++ b/site/src/App.vue @@ -7,7 +7,8 @@ - + + diff --git a/site/src/components/Game.vue b/site/src/components/Game.vue new file mode 100644 index 0000000..732bb2c --- /dev/null +++ b/site/src/components/Game.vue @@ -0,0 +1,38 @@ + + + \ No newline at end of file diff --git a/site/src/components/GameStatus.vue b/site/src/components/GameStatus.vue new file mode 100644 index 0000000..d3d6d9f --- /dev/null +++ b/site/src/components/GameStatus.vue @@ -0,0 +1,27 @@ + + + \ No newline at end of file diff --git a/site/src/components/Player.vue b/site/src/components/Player.vue new file mode 100644 index 0000000..1736e49 --- /dev/null +++ b/site/src/components/Player.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/site/src/components/PlayerHP.vue b/site/src/components/PlayerHP.vue new file mode 100644 index 0000000..03bd291 --- /dev/null +++ b/site/src/components/PlayerHP.vue @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/site/src/lib/game.ts b/site/src/lib/game.ts new file mode 100644 index 0000000..fa7758e --- /dev/null +++ b/site/src/lib/game.ts @@ -0,0 +1,59 @@ +/** + * Overall game state as received from the server. + */ +export interface Game { + /** + * Players in the game. + * The first element is the dealer and the second is the challenger. + */ + players: [Player, Player]; + /** + * Round number. + */ + round: number; + /** + * Damage that a live round will deal this turn. + */ + damage: number; + /** + * The current shell if it is revealed for the player receiving this state. + */ + shell?: boolean; + /** + * The previous discharged shell, if any. + */ + previous: boolean | null; + /** + * Number of live shells this game. + * Only included on the first turn of the game. + */ + live?: number; + /** + * Number of blank shells this game. + * Only included on the first tuurn of the game. + */ + blank?: number; +} + +/** + * Displayed state of a player as received from the server. + */ +export interface Player { + hp: number; + items: string[]; + cuffs?: boolean; +} + +/** + * DTO for the game start. + */ +export interface GameStart { + /** + * Game ID for sharing. + */ + id: string; + /** + * Whether the player receiving this object is the dealer. + */ + dealer: boolean; +}