Enhance Voting and Home screens with pixel art styles; add player voting status list and update button designs for improved UI experience

This commit is contained in:
2025-04-24 17:56:53 +02:00
parent 38ed69bf5b
commit fca6baa694
8 changed files with 221 additions and 61 deletions

View File

@ -539,8 +539,15 @@ class GameManager {
return { error: 'Invalid song ID' };
}
// Record the vote
lobby.currentBattle.votes.set(playerId, songId);
// Find player name for display purposes
const player = lobby.players.find(p => p.id === playerId);
const playerName = player ? player.name : 'Unknown Player';
// Record the vote with player name for UI display
lobby.currentBattle.votes.set(playerId, {
songId,
playerName
});
// Update vote counts
if (songId === lobby.currentBattle.song1.id) {
@ -549,6 +556,9 @@ class GameManager {
lobby.currentBattle.song2Votes++;
}
// Add a voteCount attribute for easier UI rendering
lobby.currentBattle.voteCount = lobby.currentBattle.votes.size;
// Check if all connected players have voted
const connectedPlayers = lobby.players.filter(p => p.isConnected).length;
const voteCount = lobby.currentBattle.votes.size;