From afdedbe7477903eed8d8715da1ca5f77aa16146f Mon Sep 17 00:00:00 2001 From: Whykioh Date: Wed, 4 Mar 2026 00:27:04 +0100 Subject: [PATCH] Finish (i think) --- poker-paf/Game_Win.css | 173 +++++++++++++++++++++++++++++++++++ poker-paf/game.php | 60 ++++++++++-- poker-paf/modify_money.php | 31 +++++++ poker-paf/start_new_game.php | 24 +++-- 4 files changed, 270 insertions(+), 18 deletions(-) create mode 100644 poker-paf/Game_Win.css create mode 100644 poker-paf/modify_money.php diff --git a/poker-paf/Game_Win.css b/poker-paf/Game_Win.css new file mode 100644 index 0000000..d8824df --- /dev/null +++ b/poker-paf/Game_Win.css @@ -0,0 +1,173 @@ +/* Le panneau qui contient tout le message de fin */ +/* Le rideau qui floute l'arrière-plan */ +.win-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.7); /* Fond noir semi-transparent */ + backdrop-filter: blur(8px); /* C'est ici qu'on met le flou ! */ + z-index: 9998; /* Juste en dessous du panel */ + display: flex; + justify-content: center; + align-items: center; +} + +/* On ajuste le win-panel pour qu'il soit propre à l'intérieur */ +.win-panel { + position: relative; /* Plus besoin de fixed ici car l'overlay l'est déjà */ + background: #1a1a1a; + padding: 40px; + border-radius: 20px; + border: 3px solid #ffd700; + box-shadow: 0 0 50px rgba(0, 0, 0, 1); + z-index: 9999; + text-align: center; + min-width: 400px; + display: flex; + flex-direction: column; + gap: 25px; +} + +/* Le titre dans le panel */ +.win-panel h2 { + color: #fff; + margin: 0; + font-family: 'Arial Black', sans-serif; + text-transform: uppercase; + line-height: 1.4; + text-shadow: 2px 2px 4px rgba(0,0,0,0.5); +} + +/* Zone qui contient les boutons des joueurs */ +#winner-buttons-area { + display: flex; + flex-wrap: wrap; /* Si beaucoup de joueurs, ils vont à la ligne */ + justify-content: center; + gap: 15px; + width: 100%; +} + +/* Tes boutons .btn-win (on réutilise le style Or précédent) */ +.btn-win { + background: linear-gradient(to bottom, #ffd700, #b8860b); + border: 2px solid #8b4513; + color: #000; + padding: 15px 30px; + font-weight: bold; + cursor: pointer; + border-radius: 8px; + transition: transform 0.2s; +} + +.btn-win:hover { + transform: scale(1.1); +} + +.btn-win:active { + transform: translateY(3px); + box-shadow: 0 1px 0 #5d2e0a; +} + +/* Base commune pour tous les boutons de l'interface */ +.btn-back, .btn-replay { + border-radius: 8px; + color: white; + cursor: pointer; + font-size: 1rem; + font-weight: bold; + padding: 10px 20px; + text-transform: uppercase; + transition: all 0.2s ease; + border: 2px solid rgba(0,0,0,0.2); +} + +/* Style spécifique : Retour (Style plus sobre / Alerte) */ +.btn-back { + background: linear-gradient(to bottom, #d9534f, #a94442); /* Rouge profond */ + box-shadow: 0 4px 0 #7b2e2c; +} + +.btn-back:hover { + filter: brightness(1.1); + transform: translateY(-2px); + box-shadow: 0 6px 0 #7b2e2c; +} + +/* Style spécifique : Rejouer (Style Action / Casino) */ +.btn-replay { + background: linear-gradient(to bottom, #5bc0de, #2aabd2); /* Bleu électrique */ + box-shadow: 0 4px 0 #1b728c; +} + +.btn-replay:hover { + filter: brightness(1.1); + transform: translateY(-2px); + box-shadow: 0 6px 0 #1b728c; +} + +/* Animation au clic pour les deux */ +.btn-back:active, .btn-replay:active { + transform: translateY(3px); + box-shadow: 0 1px 0 rgba(0,0,0,0.5); +} + +.blur-effect { + filter: blur(5px); + pointer-events: none; /* Empêche de cliquer sur la table derrière */ +} + + + + +/* Le conteneur avec la bordure dorée fine */ +.money-group { + display: inline-flex; + align-items: stretch; /* Force le bouton à prendre toute la hauteur */ + background: #1e1e1e; /* Fond très sombre pour faire ressortir l'or */ + border: 1px solid #c5a059; /* Bordure Or mat (plus sobre que le jaune brillant) */ + border-radius: 8px; + overflow: hidden; /* Pour que le bouton épouse l'arrondi de la bordure */ + height: 40px; /* Hauteur fixe pour un look plus pro */ +} + +/* Le champ de saisie */ +#money-amount { + background: transparent; + border: none; + color: #ffffff; + font-size: 1rem; + padding: 0 15px; + width: 100px; /* Ajustable selon tes besoins */ + outline: none; +} + +/* Le bouton OK qui occupe tout l'espace à droite */ +.btn-money { + background: linear-gradient(45deg, #d4af37, #f9e27d); /* Fond Or mat */ + border: none; + color: #1e1e1e; /* Texte sombre pour le contraste */ + cursor: pointer; + font-weight: 800; + padding: 0 20px; /* Largeur du bouton */ + text-transform: uppercase; + transition: background 0.2s ease; + display: flex; + align-items: center; /* Centre le texte "OK" verticalement */ +} + +.btn-money:hover { + filter: brightness(1.2); /* Or un peu plus clair au survol */ +} + +.btn-money:active { + filter: brightness(0.8); /* Or plus sombre au clic */ +} + +/* Suppression des flèches de l'input */ +#money-amount::-webkit-inner-spin-button, +#money-amount::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} \ No newline at end of file diff --git a/poker-paf/game.php b/poker-paf/game.php index 622b33f..704c732 100644 --- a/poker-paf/game.php +++ b/poker-paf/game.php @@ -62,12 +62,17 @@ foreach ($players as $p) { Poker PAF - Table N°<?php echo $game_id; ?> +
-
POT TOTAL:
+
+ + +
+
MISE ACTUELLE:
@@ -139,7 +144,6 @@ foreach ($players as $p) { players.push( { id: , - name: "", money: , blind: , isDealer: @@ -186,8 +190,7 @@ foreach ($players as $p) { } if (player.money < delta_blind) { // Correction ici : on compare avec le delta, pas la blinde totale - alert("Vous n'avez pas assez d'argent pour suivre, tapis requis"); - return; + delta_blind = player.money; // Si le joueur n'a pas assez, il suit avec tout ce qu'il lui reste (all-in) } // 2. On prépare l'envoi @@ -312,7 +315,7 @@ foreach ($players as $p) { console.log("Blind actuel :", current_blind); - document.getElementById('main-pot').textContent = totalBlind + " 🪙"; + //document.getElementById('main-pot').textContent = totalBlind + " 🪙"; document.getElementById('current-bet').textContent = current_blind + " 🪙"; document.getElementById('Mise').textContent = "Mise: " + current_blind; } @@ -335,7 +338,7 @@ foreach ($players as $p) { }) .then(data => { if (data.success) { - console.log("Joueur changé avec succès !"); + console.log("Joueur changé avec succès !", data.next_player_id); // On attend un tout petit peu avant de recharger pour laisser la BDD respirer setTimeout(() => { location.reload(); @@ -511,6 +514,8 @@ foreach ($players as $p) { // 2. On évite de créer le panel deux fois if (document.querySelector('.win-panel')) return; + const winOverlay = document.createElement('div'); + winOverlay.className = 'win-overlay'; const winPanel = document.createElement('div'); winPanel.className = 'win-panel'; winPanel.innerHTML = ` @@ -518,7 +523,8 @@ foreach ($players as $p) {
`; - container.appendChild(winPanel); + winOverlay.appendChild(winPanel); + container.appendChild(winOverlay); // 3. Récupération dynamique des noms des joueurs présents à l'écran const area = document.getElementById('winner-buttons-area'); @@ -534,6 +540,10 @@ foreach ($players as $p) { btn.onclick = () => declareWinner(id); area.appendChild(btn); }); + + // On affiche l'overlay (qui contient le panel) + document.getElementById('end-game-screen').style.display = 'flex'; + container.classList.add('blur-effect'); // On ajoute un effet de flou à la table pour mettre en avant le panel de victoire } function declareWinner(winnerId) { @@ -588,6 +598,40 @@ foreach ($players as $p) { }) .catch(err => console.error("Erreur fetch:", err)); } + + + + + function ModifierArgent() { + let amount = parseInt(document.getElementById('money-amount').value); + if (isNaN(amount)) { + alert("Veuillez entrer un montant valide."); + return; + } + + let formData = new FormData(); + formData.append('game_id', actualGameID); + formData.append('amount', amount); + + fetch('modify_money.php', { + method: 'POST', + body: formData + }) + .then(r => r.json()) + .then(data => { + if (data.success) { + console.log("Argent modifié avec succès !"); + setTimeout(() => { + location.reload(); + }, 100); + } else { + alert("Erreur : " + data.message); + } + }) + .catch(err => console.error("Erreur fetch:", err)); + } + + - + \ No newline at end of file diff --git a/poker-paf/modify_money.php b/poker-paf/modify_money.php new file mode 100644 index 0000000..c9be8df --- /dev/null +++ b/poker-paf/modify_money.php @@ -0,0 +1,31 @@ +prepare("SELECT current_player_id FROM games WHERE id = ?"); + $stmt->execute([$game_id]); + $game = $stmt->fetch(); + $current_player_id = $game['current_player_id']; + + // 2. Récupérer l'argent du joueur actuel + $stmt = $db->prepare("SELECT money FROM players WHERE id = ?"); + $stmt->execute([$current_player_id]); + $player = $stmt->fetch(); + $money = $player['money']; + + // 3. Mettre à jour l'argent du joueur actuel + $new_money = $money + $amount; + $stmt = $db->prepare("UPDATE players SET money = ? WHERE id = ?"); + $stmt->execute([$new_money, $current_player_id]); + + echo json_encode(['success' => true, 'money' => $money, 'player_id' => $current_player_id]); + +} catch (Exception $e) { + echo json_encode(['success' => false, 'message' => $e->getMessage()]); +} +?> \ No newline at end of file diff --git a/poker-paf/start_new_game.php b/poker-paf/start_new_game.php index 3969f5e..1e32dfd 100644 --- a/poker-paf/start_new_game.php +++ b/poker-paf/start_new_game.php @@ -15,44 +15,48 @@ try { } // 2. Faire en sorte que le dealer de la partie soit le joueur suivant l'actuel dealer - $stmt = $db->prepare("SELECT id FROM player WHERE is_dealer = 1 AND game_id = ?"); + $stmt = $db->prepare("SELECT id FROM players WHERE is_dealer = 1 AND game_id = ?"); $stmt->execute([$game_id]); $current_dealer = $stmt->fetch(); if ($current_dealer) { $current_dealer_id = $current_dealer['id']; // On remet à 0 le dealer actuel - $stmt = $db->prepare("UPDATE player SET is_dealer = 0 WHERE id = ?"); + $stmt = $db->prepare("UPDATE players SET is_dealer = 0 WHERE id = ?"); $stmt->execute([$current_dealer_id]); // On cherche le prochain dealer - $stmt = $db->prepare("SELECT id FROM player WHERE game_id = ? AND id > ? ORDER BY id ASC LIMIT 1"); + $stmt = $db->prepare("SELECT id FROM players WHERE game_id = ? AND id > ? ORDER BY id ASC LIMIT 1"); $stmt->execute([$game_id, $current_dealer_id]); $next_dealer = $stmt->fetch(); if (!$next_dealer) { // Si on est au dernier, on revient au premier - $stmt = $db->prepare("SELECT id FROM player WHERE game_id = ? ORDER BY id ASC LIMIT 1"); + $stmt = $db->prepare("SELECT id FROM players WHERE game_id = ? ORDER BY id ASC LIMIT 1"); $stmt->execute([$game_id]); $next_dealer = $stmt->fetch(); } $next_dealer_id = $next_dealer['id']; // On met à jour le nouveau dealer - $stmt = $db->prepare("UPDATE player SET is_dealer = 1 WHERE id = ?"); + $stmt = $db->prepare("UPDATE players SET is_dealer = 1 WHERE id = ?"); $stmt->execute([$next_dealer_id]); } else { // Si aucun dealer n'est défini, on choisit le premier joueur comme dealer - $stmt = $db->prepare("SELECT id FROM player WHERE game_id = ? ORDER BY id ASC LIMIT 1"); + $stmt = $db->prepare("SELECT id FROM players WHERE game_id = ? ORDER BY id ASC LIMIT 1"); $stmt->execute([$game_id]); $first_player = $stmt->fetch(); if ($first_player) { $first_player_id = $first_player['id']; - $stmt = $db->prepare("UPDATE player SET is_dealer = 1 WHERE id = ?"); + $stmt = $db->prepare("UPDATE players SET is_dealer = 1 WHERE id = ?"); $stmt->execute([$first_player_id]); } else { throw new Exception("Aucun joueur dans la partie pour devenir dealer."); } + } - + // 3. On réveille les joueurs endormis + $stmt = $db->prepare("UPDATE players SET is_folded = 0 WHERE game_id = ?"); + $stmt->execute([$game_id]); + + echo json_encode(['success' => true, 'message' => "Nouvelle partie commencée, dealer mis à jour."]); - - } catch (Exception $e) { +} catch (Exception $e) { echo json_encode(['success' => false, 'message' => $e->getMessage()]); }