mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2026-11-09 18:37:07 +01:00
tournament working but still some problems
This commit is contained in:
@@ -388,32 +388,31 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
} else if (data.type === 'game_state_update') {
|
||||
updateGameState(data.game_state);
|
||||
} else if (data.type === 'player_disconnected') {
|
||||
console.log("Player disconnected:", data.player);
|
||||
console.log('Player disconnected:', data.player);
|
||||
} else if (data.type === 'game_ended') {
|
||||
console.log("Game ended:", data.game_id);
|
||||
console.log('Game ended:', data.game_id);
|
||||
} else if (data.type === 'error') {
|
||||
console.error(data.message);
|
||||
// Assuming you're inside some WebSocket message handling function
|
||||
} else if (data.type === 'update_tournament_waiting_room') {
|
||||
// Update the HTML content of the tournament bracket
|
||||
document.getElementById('tournament-bracket').innerHTML = data.html;
|
||||
|
||||
// Reattach the event listener to the "Start Tournament" button
|
||||
const startButton = document.getElementById('start-tournament-btn');
|
||||
if (startButton) {
|
||||
startButton.addEventListener('click', function() {
|
||||
if (typeof socket !== 'undefined' && socket.readyState === WebSocket.OPEN) {
|
||||
console.log("Start TOURNAMENT sent..");
|
||||
console.log('Start TOURNAMENT sent..');
|
||||
socket.send(JSON.stringify({type: 'start_tournament'}));
|
||||
} else {
|
||||
console.error("WebSocket is not open or undefined");
|
||||
console.error('WebSocket is not open or undefined');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error('Start button not found');
|
||||
}
|
||||
} else if (data.type === 'update_brackets') {
|
||||
// Update the HTML content of the tournament bracket
|
||||
document.getElementById('tournament-bracket').innerHTML = data.html;
|
||||
} else if (data.type === 'tournament_end') {
|
||||
console.log('Tournament ended, the winner is:', data.winner);
|
||||
} else {
|
||||
console.log('Message from server:', data.type, data.message);
|
||||
}
|
||||
@@ -443,7 +442,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
function updateGameState(newState) {
|
||||
gameState = newState;
|
||||
renderGame();
|
||||
checkForWinner();
|
||||
//checkForWinner();
|
||||
}
|
||||
|
||||
function renderGame() {
|
||||
|
||||
@@ -279,7 +279,6 @@ button:hover {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
@@ -298,7 +297,6 @@ button:hover {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.dropdown-content a {
|
||||
color: #ffffff;
|
||||
padding: 12px 16px;
|
||||
@@ -308,7 +306,6 @@ button:hover {
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
|
||||
.dropdown-content a:hover {
|
||||
background-color: #333;
|
||||
color: #00ffff;
|
||||
@@ -404,7 +401,7 @@ pre {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
/*
|
||||
.tournament-waiting-room {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
padding: 20px;
|
||||
@@ -435,7 +432,7 @@ pre {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
*/
|
||||
body {
|
||||
color: rgb(0, 255, 255); /* Valeur par défaut */
|
||||
font-family: Arial, sans-serif;
|
||||
|
||||
Reference in New Issue
Block a user