uyk wd<ehsgfesjkhgfvk
This commit is contained in:
+22
-34
@@ -430,55 +430,50 @@ button.btn-back {
|
|||||||
|
|
||||||
/* Conteneur principal en overlay */
|
/* Conteneur principal en overlay */
|
||||||
.win-panel {
|
.win-panel {
|
||||||
/* Positionnement fixe au milieu de l'écran ou du container */
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%); /* Centrage parfait */
|
||||||
|
|
||||||
/* Style du panneau */
|
width: 450px;
|
||||||
width: 400px;
|
background: rgba(15, 15, 15, 0.98);
|
||||||
background-color: rgba(20, 20, 20, 0.95); /* Fond sombre opaque */
|
border: 3px solid #d4af37;
|
||||||
border: 3px solid #d4af37; /* Bordure dorée */
|
border-radius: 20px;
|
||||||
border-radius: 15px;
|
padding: 30px;
|
||||||
padding: 25px;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
|
z-index: 10000; /* Toujours au-dessus */
|
||||||
|
box-shadow: 0 0 50px rgba(0, 0, 0, 1);
|
||||||
/* S'assurer qu'il passe devant tout */
|
animation: scaleUp 0.3s ease-out;
|
||||||
z-index: 9999;
|
|
||||||
}
|
}
|
||||||
/* Titre du panel */
|
|
||||||
.win-panel h2 {
|
.win-panel h2 {
|
||||||
color: #ffffff;
|
color: #d4af37;
|
||||||
font-size: 1.4rem;
|
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
font-family: Arial, sans-serif;
|
font-size: 1.6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zone des boutons */
|
|
||||||
#winner-buttons-area {
|
#winner-buttons-area {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 10px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Style des boutons joueurs */
|
|
||||||
.btn-win {
|
.btn-win {
|
||||||
background: #444;
|
background: #1a4a31;
|
||||||
color: white;
|
color: white;
|
||||||
border: 1px solid #d4af37;
|
border: 1px solid #d4af37;
|
||||||
padding: 8px 15px;
|
padding: 10px 20px;
|
||||||
border-radius: 5px;
|
border-radius: 8px;
|
||||||
|
font-weight: bold;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 0.9rem;
|
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-win:hover {
|
.btn-win:hover {
|
||||||
background: #d4af37;
|
background: #d4af37;
|
||||||
color: #000;
|
color: black;
|
||||||
|
transform: scale(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bouton Rejouer / Retour Accueil */
|
/* Bouton Rejouer / Retour Accueil */
|
||||||
@@ -510,16 +505,9 @@ button.btn-back {
|
|||||||
filter: brightness(1.2);
|
filter: brightness(1.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Petite animation d'entrée */
|
@keyframes scaleUp {
|
||||||
@keyframes fadeInScale {
|
from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
|
||||||
from {
|
to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
|
||||||
opacity: 0;
|
|
||||||
transform: translate(-50%, -60%) scale(0.8);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translate(-50%, -50%) scale(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- ADAPTATION MOBILE --- */
|
/* --- ADAPTATION MOBILE --- */
|
||||||
|
|||||||
+28
-19
@@ -499,39 +499,44 @@ foreach ($players as $p) {
|
|||||||
|
|
||||||
// --- FONCTION EN CAS DE VICTOIRE ---
|
// --- FONCTION EN CAS DE VICTOIRE ---
|
||||||
function EndGame() {
|
function EndGame() {
|
||||||
// 1. On cible le container
|
// 1. On cherche le container par sa classe
|
||||||
const container = document.querySelector('.table-container');
|
const container = document.querySelector('.table-container');
|
||||||
|
|
||||||
// 2. On vérifie s'il n'y a pas déjà un panel
|
if (!container) {
|
||||||
|
console.error("Conteneur .table-container introuvable");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. On évite de créer le panel deux fois
|
||||||
if (document.querySelector('.win-panel')) return;
|
if (document.querySelector('.win-panel')) return;
|
||||||
|
|
||||||
const newRow = document.createElement('div');
|
const winPanel = document.createElement('div');
|
||||||
newRow.className = 'win-panel';
|
winPanel.className = 'win-panel';
|
||||||
|
winPanel.innerHTML = `
|
||||||
newRow.innerHTML = `
|
<h2>🏆 La partie est terminée ! 🏆<br>Qui a gagné ?</h2>
|
||||||
<h2>La partie est terminée !<br>Qui a gagné ?</h2>
|
|
||||||
<div id="winner-buttons-area"></div>
|
<div id="winner-buttons-area"></div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
container.appendChild(newRow);
|
container.appendChild(winPanel);
|
||||||
|
|
||||||
// 3. On ajoute les boutons des joueurs depuis l'objet 'players' global
|
// 3. Récupération dynamique des noms des joueurs présents à l'écran
|
||||||
const area = document.getElementById('winner-buttons-area');
|
const area = document.getElementById('winner-buttons-area');
|
||||||
|
const playerElements = document.querySelectorAll('.player-slot');
|
||||||
|
|
||||||
|
playerElements.forEach(slot => {
|
||||||
|
const id = slot.getAttribute('data-id');
|
||||||
|
const name = slot.querySelector('.player-name').textContent.split(': ')[1];
|
||||||
|
|
||||||
// On boucle sur tes joueurs pour créer les boutons
|
|
||||||
players.forEach(p => {
|
|
||||||
const btn = document.createElement('button');
|
const btn = document.createElement('button');
|
||||||
btn.className = 'btn-win';
|
btn.className = 'btn-win';
|
||||||
// On récupère le nom depuis le DOM si players n'est pas à jour
|
btn.innerText = name;
|
||||||
const playerName = document.querySelector(`[data-id="${p.id}"] .player-name`)?.textContent || "Joueur";
|
btn.onclick = () => declareWinner(id);
|
||||||
btn.innerText = playerName.replace(/J\d+ : /, ''); // Nettoie le "J1 : "
|
|
||||||
|
|
||||||
btn.onclick = () => declareWinner(p.id);
|
|
||||||
area.appendChild(btn);
|
area.appendChild(btn);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 4. Effet de flou sur la table
|
// 4. Effet visuel sur la table
|
||||||
document.querySelector('.poker-table').style.filter = 'blur(8px) brightness(0.5)';
|
const table = document.querySelector('.poker-table');
|
||||||
|
if (table) table.style.filter = 'blur(5px) brightness(0.5)';
|
||||||
}
|
}
|
||||||
|
|
||||||
function declareWinner(winnerId) {
|
function declareWinner(winnerId) {
|
||||||
@@ -546,7 +551,11 @@ foreach ($players as $p) {
|
|||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
confetti();
|
confetti({
|
||||||
|
particleCount: 150,
|
||||||
|
spread: 70,
|
||||||
|
origin: { y: 0.6 }
|
||||||
|
});
|
||||||
// Changer la div "win-panel" pour afficher le gagnant
|
// Changer la div "win-panel" pour afficher le gagnant
|
||||||
const winPanel = document.querySelector('.win-panel');
|
const winPanel = document.querySelector('.win-panel');
|
||||||
if (winPanel) {
|
if (winPanel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user