add game controls

This commit is contained in:
Branden J Brown 2024-01-30 21:31:16 -06:00
parent 53f18599a3
commit 72304fab0b
2 changed files with 35 additions and 0 deletions

View File

@ -18,6 +18,21 @@
<Player :stats="props.game.players[1]" :dealer="false" /> <Player :stats="props.game.players[1]" :dealer="false" />
</v-col> </v-col>
</v-row> </v-row>
<v-row v-if="myTurn" class="py-4">
<v-col cols="1"></v-col>
<v-col cols="5">
<v-btn block>SHOOT {{ dealerTarget }}</v-btn>
</v-col>
<v-col cols="5">
<v-btn block>SHOOT {{ challTarget }}</v-btn>
</v-col>
</v-row>
<v-row v-else class="py-4">
<v-col cols="3"></v-col>
<v-col cols="6">
<v-btn block disabled>THE {{ currentTurn }} IS CONSIDERING</v-btn>
</v-col>
</v-row>
</v-sheet> </v-sheet>
</v-row> </v-row>
</v-container> </v-container>
@ -25,11 +40,24 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Game } from '@/lib/game'; import type { Game } from '@/lib/game';
import { computed } from 'vue';
export interface Props { export interface Props {
/**
* Game state to display.
*/
game: Game; game: Game;
/**
* Whether this client is connected as the dealer.
*/
dealer: boolean; dealer: boolean;
} }
const props = defineProps<Props>(); const props = defineProps<Props>();
const myTurn = computed(() => props.dealer === props.game.dealer);
const currentTurn = computed(() => props.game.dealer ? 'DEALER' : 'CHALLENGER');
const dealerTarget = computed(() => props.dealer ? 'YOURSELF' : 'THE DEALER');
const challTarget = computed(() => props.dealer ? 'THE CHALLENGER' : 'YOURSELF');
</script> </script>

View File

@ -61,3 +61,10 @@ export interface GameStart {
*/ */
dealer: boolean; dealer: boolean;
} }
/**
* Commands sent to the server.
*/
export interface Action {
action: "quit" | "across" | "self" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7";
}