removed comments
This commit is contained in:
@@ -1,35 +1,52 @@
|
||||
<template>
|
||||
<div class="relative min-h-screen overflow-hidden">
|
||||
<div v-if="store.isGameRunning" class="absolute top-4 right-4 z-50">
|
||||
<button @click="handleSurrender"
|
||||
class="bg-red-600 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-lg shadow-lg border-2 border-red-800 transition-all transform hover:scale-105 flex items-center gap-2">
|
||||
<button
|
||||
@click="handleSurrender"
|
||||
class="bg-red-600 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-lg shadow-lg border-2 border-red-800 transition-all transform hover:scale-105 flex items-center gap-2"
|
||||
>
|
||||
<span>🏳️</span> Surrender
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="store.isGameRunning">
|
||||
<GameBoard :trump-card="store.trumpCard" :cards-remaining="store.deck.length + (store.trumpCard ? 1 : 0)"
|
||||
:player-hand="store.playerHand" :opponent-hand="store.opponentHand" :player-score="store.playerScore"
|
||||
:opponent-score="store.opponentScore" :current-turn="'player'" :is-my-turn="true" :current-trick="store.table"
|
||||
:player-name="'You'" :opponent-name="'CPU'" @play-card="handlePlayCard" />
|
||||
<GameBoard
|
||||
:trump-card="store.trumpCard"
|
||||
:cards-remaining="store.deck.length + (store.trumpCard ? 1 : 0)"
|
||||
:player-hand="store.playerHand"
|
||||
:opponent-hand="store.opponentHand"
|
||||
:player-score="store.playerScore"
|
||||
:opponent-score="store.opponentScore"
|
||||
:current-turn="'player'"
|
||||
:is-my-turn="true"
|
||||
:current-trick="store.table"
|
||||
:player-name="'You'"
|
||||
:opponent-name="'CPU'"
|
||||
@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">Preparing game...</div>
|
||||
</div>
|
||||
|
||||
|
||||
<GameOver :is-visible="store.isGameOver" :winner="store.winner || 'draw'" :player-score="store.playerScore"
|
||||
<GameOver
|
||||
:is-visible="store.isGameOver"
|
||||
:winner="store.winner || 'draw'"
|
||||
:player-score="store.playerScore"
|
||||
:opponent-score="store.opponentScore"
|
||||
:stats="{ playerTricks: store.playerTricks, opponentTricks: store.opponentTricks }"
|
||||
:is-logging-out="store.isLoggingOut" @play-again="handlePlayAgain" @close="handleCloseModal" />
|
||||
:is-logging-out="store.isLoggingOut"
|
||||
@play-again="handlePlayAgain"
|
||||
@close="handleCloseModal"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, onUnmounted, onBeforeMount, watch } from 'vue'
|
||||
import { useRouter, onBeforeRouteLeave } from 'vue-router'
|
||||
import { toast } from 'vue-sonner' // Import Toast for feedback
|
||||
import { toast } from 'vue-sonner'
|
||||
import { useBiscaStore } from '@/stores/bisca'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import GameBoard from '@/components/game/GameBoard.vue'
|
||||
@@ -46,10 +63,13 @@ const store = useBiscaStore()
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
// DEBUG: Watch the store state
|
||||
watch(() => store.playerHand, (newHand) => {
|
||||
console.log('Player hand updated:', newHand)
|
||||
}, { deep: true })
|
||||
watch(
|
||||
() => store.playerHand,
|
||||
(newHand) => {
|
||||
console.log('Player hand updated:', newHand)
|
||||
},
|
||||
{ deep: true },
|
||||
)
|
||||
|
||||
onBeforeMount(() => {
|
||||
store.isGameOver = false
|
||||
@@ -59,12 +79,11 @@ onMounted(() => {
|
||||
store.startGame(props.gameType)
|
||||
window.addEventListener('beforeunload', handleBrowserUnload)
|
||||
|
||||
// DEBUG: Log initial state
|
||||
setTimeout(() => {
|
||||
console.log('Game state after init:', {
|
||||
playerHand: store.playerHand,
|
||||
currentTurn: store.currentTurn,
|
||||
isGameRunning: store.isGameRunning
|
||||
isGameRunning: store.isGameRunning,
|
||||
})
|
||||
}, 500)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user