Added game start for single player, 3 and 9 card game types and protected the pages for only logged in players
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div v-if="store.trumpCard">
|
||||
<GameBoard
|
||||
:trump-card="store.trumpCard"
|
||||
:cards-remaining="store.deck.length"
|
||||
:player-hand="store.playerHand"
|
||||
:opponent-hand="store.opponentHand"
|
||||
|
||||
:player-score="store.playerScore"
|
||||
:opponent-score="store.opponentScore"
|
||||
:current-turn="store.currentTurn"
|
||||
:current-trick="store.table"
|
||||
@play-card="handlePlayCard"
|
||||
/>
|
||||
</div>
|
||||
<div v-else class="flex h-screen items-center justify-center bg-green-900 text-white">
|
||||
<div class="animate-pulse text-xl">A baralhar cartas...</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, onUnmounted } from 'vue'
|
||||
import { useBiscaStore } from '@/stores/bisca'
|
||||
import GameBoard from '@/components/game/GameBoard.vue'
|
||||
|
||||
const props = defineProps({
|
||||
gameType: {
|
||||
type: Number,
|
||||
default: 3,
|
||||
},
|
||||
})
|
||||
|
||||
const store = useBiscaStore()
|
||||
|
||||
onMounted(() => {
|
||||
console.log(`A iniciar Bisca de ${props.gameType}...`)
|
||||
store.startGame(props.gameType)
|
||||
})
|
||||
|
||||
const handlePlayCard = (card) => {
|
||||
store.playerPlayCard(card)
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user