thrashfer

This commit is contained in:
2024-09-17 15:37:26 +02:00
parent c78b3a43ac
commit 6392d247a5
6 changed files with 578 additions and 39 deletions

View File

@@ -614,6 +614,47 @@ document.addEventListener('DOMContentLoaded', () => {
starsContainer.appendChild(star);
}
const homeButton = document.getElementById('home');
const replayButton = document.getElementById('retry');
const gameControls = document.getElementById('game-controls');
homeButton.addEventListener('click', () => {
gameContainer.style.display = 'none';
gameControls.style.display = 'none';
logo.style.display = 'block'
formBlock.style.display = 'block';
postFormButtons.style.display = 'flex';
setupFirstPlayer();
});
function setupFirstPlayer() {
const firstPlayerName = window.firstPlayerName;
document.getElementById('player1-name').textContent = firstPlayerName;
}
replayButton.addEventListener('click', () => {
document.getElementById('player1-name').textContent = saveData.player1_name;
document.getElementById('player2-name').textContent = saveData.player2_name;
startLocalGame2();
});
function checkForWinner() {
if (gameState.player1_score === 3 || gameState.player2_score === 3) {
if (saveData.type != "tournoi"){
gameControls.style.display = 'flex';
homeButton.style.display = 'block';
replayButton.style.display = 'none';
console.log(saveData.type);
if (saveData.type === 'local'){
replayButton.style.display = 'block';
}
}
}
}
// Détection de la commande /s username
function sendStatsCommand(targetUser) {
console.log(`Detected stats command for user: ${targetUser}`);

View File

@@ -216,8 +216,6 @@
</div>
<div id="chat-controls">
<!-- Autres éléments du chat -->
<button id="quit-room-btn">Quitter la room</button>
<button id="show-chat">Afficher le Chat</button>
<button id="hide-chat">Masquer le Chat</button>
</div>
@@ -320,20 +318,6 @@
});
});
</script>
<script>
const starsContainer = document.getElementById('stars');
for (let i = 0; i < 500; i++) {
const star = document.createElement('div');
star.className = 'star';
star.style.width = `${Math.random() * 3}px`;
star.style.height = star.style.width;
star.style.left = `${Math.random() * 100}%`;
star.style.top = `${Math.random() * 100}%`;
star.style.animationDuration = `${Math.random() * 2 + 1}s`;
starsContainer.appendChild(star);
}
</script>
</body>
</html>

View File

@@ -702,20 +702,3 @@ canvas {
transform: translateY(20px);
opacity: 0;
}
#quit-room-btn, #show-chat-btn {
display: inline-block;
padding: 5px 10px;
margin: 5px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
text-align: center;
font-size: 14px;
}
#quit-room-btn:hover, #show-chat-btn:hover {
background-color: #0056b3;
}