use a game as the game
This commit is contained in:
parent
c5c4559e08
commit
e8cdeda66a
@ -7,7 +7,7 @@
|
||||
</template>
|
||||
</v-app-bar>
|
||||
<v-main>
|
||||
<Game v-if="playing" :game="data" :dealer="dealer" @action="action" />
|
||||
<Game v-if="playing" :game="game" :dealer="dealer" @action="action" />
|
||||
<v-container v-else-if="loading" class="fill-height">
|
||||
<v-row class="d-flex justify-center">
|
||||
<v-progress-circular class="pa-8" indeterminate size="128"></v-progress-circular>
|
||||
|
@ -16,27 +16,23 @@ import { computed, ref, watch } from 'vue';
|
||||
import type { Game } from '@/lib/game';
|
||||
|
||||
export interface Props {
|
||||
game: Game | undefined;
|
||||
game: Game;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
// TODO(zeph): simplify this condition, this should just come in the game state
|
||||
const gameOn = computed(() => (props?.game?.round ?? 0 < 3) || (props?.game?.players?.every((p) => p.hp > 0)))
|
||||
const gameOn = computed(() => props.game.round < 3 || props.game.players.every((p) => p.hp > 0))
|
||||
|
||||
const roundChips = computed(() => [
|
||||
{ text: "I", variant: props?.game?.round === 1 ? 'elevated' : undefined },
|
||||
{ text: "II", variant: props?.game?.round === 2 ? 'elevated' : undefined },
|
||||
{ text: "III", variant: props?.game?.round === 3 ? 'elevated' : undefined },
|
||||
{ text: "I", variant: props.game.round === 1 ? 'elevated' : undefined },
|
||||
{ text: "II", variant: props.game.round === 2 ? 'elevated' : undefined },
|
||||
{ text: "III", variant: props.game.round === 3 ? 'elevated' : undefined },
|
||||
] as const)
|
||||
|
||||
// TODO(zeph): this probably should just be handled by the server and sent in the dto
|
||||
const game = computed(() => props.game);
|
||||
const msg = ref<string>('');
|
||||
watch(game, (now, was) => {
|
||||
if (now == null) {
|
||||
return;
|
||||
}
|
||||
watch(props.game, (now, was) => {
|
||||
if (now.live != null && was?.live == null) {
|
||||
msg.value = `THE SHOTGUN CONTAINS ${now.live} LIVE AND ${now.blank} BLANK SHELLS`;
|
||||
} else if (was == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user