feat: Títulos de misiones y fix timer votación post-misión
Nuevas funcionalidades:
- Títulos y subtítulos en cartas de misión
* Título: 'MISIÓN X' (blanco, mayúsculas)
* Subtítulo: Nombre de la misión (amarillo dorado)
* Objeto missionNames con 5 nombres editables:
1. Sabotaje en el Tren
2. Rescate del Prisionero
3. Destrucción del Puente
4. Robo de Documentos
5. Asalto al Cuartel General
Correcciones:
- Timer de votación de líder ahora se inicia correctamente después de terminar una misión
- Importado GamePhase en server/src/index.ts para comparaciones de fase
- Agregada lógica en finish_mission_result para iniciar timer cuando vuelve a VOTE_LEADER
- Votación se resuelve automáticamente si no todos votan (mayoría sobre votos emitidos)
Archivos modificados:
- client/src/components/GameBoard.tsx: Títulos de misiones
- server/src/index.ts: Fix timer post-misión
This commit is contained in:
@@ -5,6 +5,7 @@ import cors from 'cors';
|
||||
import dotenv from 'dotenv';
|
||||
import crypto from 'crypto';
|
||||
import { Game } from './models/Game';
|
||||
import { GamePhase } from '../../shared/types';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
@@ -251,9 +252,15 @@ io.on('connection', (socket) => {
|
||||
// 5.2 FINALIZAR PANTALLA DE RESULTADO
|
||||
socket.on('finish_mission_result', ({ roomId }) => {
|
||||
const game = games[roomId];
|
||||
if (game && game.hostId === socket.id && game.state.phase === 'mission_result') {
|
||||
if (game && game.hostId === socket.id && game.state.phase === GamePhase.MISSION_RESULT) {
|
||||
game.finishMissionResult();
|
||||
io.to(roomId).emit('game_state', game.state);
|
||||
|
||||
// Si volvió a vote_leader (nueva ronda), iniciar timer
|
||||
// TypeScript no detecta que finishMissionResult() cambia la fase, usamos type assertion
|
||||
if ((game.state.phase as GamePhase) === GamePhase.VOTE_LEADER) {
|
||||
startLeaderVoteTimer(roomId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user