WIP: Cambiar imágenes de misión y agregar tracking de votos
- Cambiar mission_success/fail a vote_approve/reject - Agregar estado missionVote para trackear voto del jugador - Agregar función handleMissionVote - Reset de voto cuando cambia la fase - Falta: actualizar onClick y agregar feedback visual
This commit is contained in:
@@ -18,6 +18,9 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB
|
|||||||
// Orden aleatorio de cartas de misión (se genera una vez)
|
// Orden aleatorio de cartas de misión (se genera una vez)
|
||||||
const [cardOrder] = useState(() => Math.random() > 0.5);
|
const [cardOrder] = useState(() => Math.random() > 0.5);
|
||||||
|
|
||||||
|
// Track del voto de misión del jugador
|
||||||
|
const [missionVote, setMissionVote] = useState<boolean | null>(null);
|
||||||
|
|
||||||
|
|
||||||
// Timer para avanzar automáticamente en REVEAL_ROLE
|
// Timer para avanzar automáticamente en REVEAL_ROLE
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -29,6 +32,14 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB
|
|||||||
}
|
}
|
||||||
}, [gameState.phase, actions]);
|
}, [gameState.phase, actions]);
|
||||||
|
|
||||||
|
// Reset missionVote cuando cambia la fase
|
||||||
|
useEffect(() => {
|
||||||
|
if (gameState.phase !== GamePhase.MISSION) {
|
||||||
|
setMissionVote(null);
|
||||||
|
}
|
||||||
|
}, [gameState.phase]);
|
||||||
|
|
||||||
|
|
||||||
const currentPlayer = gameState.players.find(p => p.id === currentPlayerId);
|
const currentPlayer = gameState.players.find(p => p.id === currentPlayerId);
|
||||||
const isLeader = gameState.currentLeaderId === currentPlayerId; // FIX: Usar currentLeaderId del estado
|
const isLeader = gameState.currentLeaderId === currentPlayerId; // FIX: Usar currentLeaderId del estado
|
||||||
const config = GAME_CONFIG[gameState.players.length as keyof typeof GAME_CONFIG];
|
const config = GAME_CONFIG[gameState.players.length as keyof typeof GAME_CONFIG];
|
||||||
@@ -45,6 +56,12 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleMissionVote = (vote: boolean) => {
|
||||||
|
setMissionVote(vote);
|
||||||
|
actions.voteMission(vote);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Coordenadas porcentuales de los hexágonos de misión en el mapa
|
// Coordenadas porcentuales de los hexágonos de misión en el mapa
|
||||||
const missionCoords = [
|
const missionCoords = [
|
||||||
{ left: '12%', top: '55%' }, // Misión 1
|
{ left: '12%', top: '55%' }, // Misión 1
|
||||||
@@ -506,7 +523,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB
|
|||||||
whileHover={{ scale: 1.1, rotate: 3 }}
|
whileHover={{ scale: 1.1, rotate: 3 }}
|
||||||
whileTap={{ scale: 0.95 }}
|
whileTap={{ scale: 0.95 }}
|
||||||
>
|
>
|
||||||
<Image src="/assets/images/tokens/mission_success.png" alt="Success" width={180} height={180} className="drop-shadow-2xl" />
|
<Image src="/assets/images/tokens/vote_approve.png" alt="Success" width={180} height={180} className="drop-shadow-2xl" />
|
||||||
<span className="mt-6 text-white font-bold text-2xl tracking-widest uppercase">ÉXITO</span>
|
<span className="mt-6 text-white font-bold text-2xl tracking-widest uppercase">ÉXITO</span>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</button>
|
</button>
|
||||||
@@ -519,7 +536,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB
|
|||||||
whileHover={{ scale: 1.1, rotate: -3 }}
|
whileHover={{ scale: 1.1, rotate: -3 }}
|
||||||
whileTap={{ scale: 0.95 }}
|
whileTap={{ scale: 0.95 }}
|
||||||
>
|
>
|
||||||
<Image src="/assets/images/tokens/mission_fail.png" alt="Fail" width={180} height={180} className="drop-shadow-2xl" />
|
<Image src="/assets/images/tokens/vote_reject.png" alt="Fail" width={180} height={180} className="drop-shadow-2xl" />
|
||||||
<span className="mt-6 text-white font-bold text-2xl tracking-widest uppercase">SABOTAJE</span>
|
<span className="mt-6 text-white font-bold text-2xl tracking-widest uppercase">SABOTAJE</span>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</button>
|
</button>
|
||||||
@@ -535,7 +552,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB
|
|||||||
whileHover={{ scale: 1.1, rotate: -3 }}
|
whileHover={{ scale: 1.1, rotate: -3 }}
|
||||||
whileTap={{ scale: 0.95 }}
|
whileTap={{ scale: 0.95 }}
|
||||||
>
|
>
|
||||||
<Image src="/assets/images/tokens/mission_fail.png" alt="Fail" width={180} height={180} className="drop-shadow-2xl" />
|
<Image src="/assets/images/tokens/vote_reject.png" alt="Fail" width={180} height={180} className="drop-shadow-2xl" />
|
||||||
<span className="mt-6 text-white font-bold text-2xl tracking-widest uppercase">SABOTAJE</span>
|
<span className="mt-6 text-white font-bold text-2xl tracking-widest uppercase">SABOTAJE</span>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</button>
|
</button>
|
||||||
@@ -548,7 +565,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB
|
|||||||
whileHover={{ scale: 1.1, rotate: 3 }}
|
whileHover={{ scale: 1.1, rotate: 3 }}
|
||||||
whileTap={{ scale: 0.95 }}
|
whileTap={{ scale: 0.95 }}
|
||||||
>
|
>
|
||||||
<Image src="/assets/images/tokens/mission_success.png" alt="Success" width={180} height={180} className="drop-shadow-2xl" />
|
<Image src="/assets/images/tokens/vote_approve.png" alt="Success" width={180} height={180} className="drop-shadow-2xl" />
|
||||||
<span className="mt-6 text-white font-bold text-2xl tracking-widest uppercase">ÉXITO</span>
|
<span className="mt-6 text-white font-bold text-2xl tracking-widest uppercase">ÉXITO</span>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user