Import initial du site depuis le serveur
This commit is contained in:
+165
-165
@@ -1,166 +1,166 @@
|
||||
<?php
|
||||
session_start();
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Configuration BDD
|
||||
$host = 'localhost';
|
||||
$db = 'yahtzee_paf';
|
||||
$user = 'root';
|
||||
$pass = '';
|
||||
|
||||
$options = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
];
|
||||
|
||||
try {
|
||||
$pdo = new PDO("mysql:host=$host;dbname=$db;charset=utf8", $user, $pass, $options);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'error' => 'Connexion échouée']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Lecture de l'input JSON
|
||||
$json = file_get_contents('php://input');
|
||||
$data = json_decode($json, true);
|
||||
|
||||
if (!$data || !isset($data['action'])) {
|
||||
echo json_encode(['success' => false, 'error' => 'Aucune action spécifiée']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$action = $data['action'];
|
||||
$params = $data['params'] ?? [];
|
||||
|
||||
switch ($action) {
|
||||
|
||||
// --- INITIALISATION ---
|
||||
|
||||
case 'createGame':
|
||||
// On insère la game avec un admin_id temporaire à 0
|
||||
$stmt = $pdo->prepare("INSERT INTO games (game_name, admin_id) VALUES (?, 0)");
|
||||
$stmt->execute([$params['game_name']]);
|
||||
$game_id = $pdo->lastInsertId();
|
||||
|
||||
echo json_encode(['success' => true, 'game_id' => $game_id]);
|
||||
exit;
|
||||
|
||||
case 'addPlayer':
|
||||
// Ajout d'un joueur avec sa couleur et définition du tour
|
||||
$stmt = $pdo->prepare("INSERT INTO players (game_id, player_name, player_color, is_turn) VALUES (?, ?, ?, ?)");
|
||||
$stmt->execute([
|
||||
(int)$params['game_id'],
|
||||
$params['name'],
|
||||
$params['color'],
|
||||
(int)$params['is_turn']
|
||||
]);
|
||||
$player_id = $pdo->lastInsertId();
|
||||
|
||||
// Si c'est le premier joueur ajouté, on le définit comme admin de la game
|
||||
if (isset($params['is_admin']) && $params['is_admin'] === true) {
|
||||
$update = $pdo->prepare("UPDATE games SET admin_id = ? WHERE id = ?");
|
||||
$update->execute([$player_id, (int)$params['game_id']]);
|
||||
$_SESSION['current_player_id'] = $player_id; // On stocke en session qui est l'admin
|
||||
}
|
||||
|
||||
echo json_encode(['success' => true, 'player_id' => $player_id]);
|
||||
exit;
|
||||
|
||||
// --- RÉCUPÉRATION ---
|
||||
|
||||
case 'getGameData':
|
||||
$game_id = (int)$params['game_id'];
|
||||
|
||||
// 1. Infos Game
|
||||
$stmt = $pdo->prepare("SELECT * FROM games WHERE id = ?");
|
||||
$stmt->execute([$game_id]);
|
||||
$game = $stmt->fetch();
|
||||
|
||||
// 2. Infos Players
|
||||
$stmt = $pdo->prepare("SELECT * FROM players WHERE game_id = ? ORDER BY id ASC");
|
||||
$stmt->execute([$game_id]);
|
||||
$players = $stmt->fetchAll();
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'game' => $game,
|
||||
'players' => $players,
|
||||
'session_player_id' => $_SESSION['current_player_id'] ?? null
|
||||
]);
|
||||
exit;
|
||||
|
||||
case 'get_all_games':
|
||||
// Liste pour l'index
|
||||
$stmt = $pdo->query("SELECT g.*, (SELECT COUNT(*) FROM players WHERE game_id = g.id) as nb_players FROM games g");
|
||||
echo json_encode(['success' => true, 'games' => $stmt->fetchAll()]);
|
||||
exit;
|
||||
|
||||
// --- GAMEPLAY & SCORES ---
|
||||
|
||||
case 'saveScore':
|
||||
// $params contient 'player_id', 'column' (ex: score_brelan), et 'value'
|
||||
$column = $params['column'];
|
||||
$allowed_columns = [
|
||||
'score_1','score_2','score_3','score_4','score_5','score_6',
|
||||
'score_brelan','score_carre','score_full','score_petite_suite',
|
||||
'score_grande_suite','score_yahtzee','score_chance'
|
||||
];
|
||||
|
||||
if (!in_array($column, $allowed_columns)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Colonne invalide']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE players SET $column = ? WHERE id = ?");
|
||||
$stmt->execute([(int)$params['value'], (int)$params['player_id']]);
|
||||
|
||||
// On recalcule le total automatiquement ici ou en JS plus tard
|
||||
echo json_encode(['success' => true]);
|
||||
exit;
|
||||
|
||||
case 'nextTurn':
|
||||
$game_id = (int)$params['game_id'];
|
||||
$current_player_id = (int)$params['player_id'];
|
||||
|
||||
// 1. Retirer le tour au joueur actuel
|
||||
$pdo->prepare("UPDATE players SET is_turn = 0 WHERE id = ?")->execute([$current_player_id]);
|
||||
|
||||
// 2. Trouver le suivant
|
||||
$stmt = $pdo->prepare("SELECT id FROM players WHERE game_id = ? AND id > ? ORDER BY id ASC LIMIT 1");
|
||||
$stmt->execute([$game_id, $current_player_id]);
|
||||
$next = $stmt->fetchColumn();
|
||||
|
||||
if (!$next) {
|
||||
$stmt = $pdo->prepare("SELECT id FROM players WHERE game_id = ? ORDER BY id ASC LIMIT 1");
|
||||
$stmt->execute([$game_id]);
|
||||
$next = $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
$pdo->prepare("UPDATE players SET is_turn = 1 WHERE id = ?")->execute([$next]);
|
||||
echo json_encode(['success' => true, 'next_player_id' => $next]);
|
||||
exit;
|
||||
|
||||
// --- ADMIN ---
|
||||
|
||||
case 'delete_game':
|
||||
$game_id = (int)$params['game_id'];
|
||||
$player_id = $_SESSION['current_player_id'] ?? 0;
|
||||
|
||||
// Vérification admin
|
||||
$stmt = $pdo->prepare("SELECT admin_id FROM games WHERE id = ?");
|
||||
$stmt->execute([$game_id]);
|
||||
$admin_id = $stmt->fetchColumn();
|
||||
|
||||
if ($admin_id == $player_id) {
|
||||
$pdo->prepare("DELETE FROM games WHERE id = ?")->execute([$game_id]);
|
||||
echo json_encode(['success' => true]);
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => 'Action réservée à l\'admin']);
|
||||
}
|
||||
exit;
|
||||
|
||||
default:
|
||||
echo json_encode(['success' => false, 'error' => 'Action inconnue']);
|
||||
exit;
|
||||
<?php
|
||||
session_start();
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Configuration BDD
|
||||
$host = 'localhost';
|
||||
$db = 'yahtzee_paf';
|
||||
$user = 'root';
|
||||
$pass = '';
|
||||
|
||||
$options = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
];
|
||||
|
||||
try {
|
||||
$pdo = new PDO("mysql:host=$host;dbname=$db;charset=utf8", $user, $pass, $options);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'error' => 'Connexion échouée']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Lecture de l'input JSON
|
||||
$json = file_get_contents('php://input');
|
||||
$data = json_decode($json, true);
|
||||
|
||||
if (!$data || !isset($data['action'])) {
|
||||
echo json_encode(['success' => false, 'error' => 'Aucune action spécifiée']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$action = $data['action'];
|
||||
$params = $data['params'] ?? [];
|
||||
|
||||
switch ($action) {
|
||||
|
||||
// --- INITIALISATION ---
|
||||
|
||||
case 'createGame':
|
||||
// On insère la game avec un admin_id temporaire à 0
|
||||
$stmt = $pdo->prepare("INSERT INTO games (game_name, admin_id) VALUES (?, 0)");
|
||||
$stmt->execute([$params['game_name']]);
|
||||
$game_id = $pdo->lastInsertId();
|
||||
|
||||
echo json_encode(['success' => true, 'game_id' => $game_id]);
|
||||
exit;
|
||||
|
||||
case 'addPlayer':
|
||||
// Ajout d'un joueur avec sa couleur et définition du tour
|
||||
$stmt = $pdo->prepare("INSERT INTO players (game_id, player_name, player_color, is_turn) VALUES (?, ?, ?, ?)");
|
||||
$stmt->execute([
|
||||
(int)$params['game_id'],
|
||||
$params['name'],
|
||||
$params['color'],
|
||||
(int)$params['is_turn']
|
||||
]);
|
||||
$player_id = $pdo->lastInsertId();
|
||||
|
||||
// Si c'est le premier joueur ajouté, on le définit comme admin de la game
|
||||
if (isset($params['is_admin']) && $params['is_admin'] === true) {
|
||||
$update = $pdo->prepare("UPDATE games SET admin_id = ? WHERE id = ?");
|
||||
$update->execute([$player_id, (int)$params['game_id']]);
|
||||
$_SESSION['current_player_id'] = $player_id; // On stocke en session qui est l'admin
|
||||
}
|
||||
|
||||
echo json_encode(['success' => true, 'player_id' => $player_id]);
|
||||
exit;
|
||||
|
||||
// --- RÉCUPÉRATION ---
|
||||
|
||||
case 'getGameData':
|
||||
$game_id = (int)$params['game_id'];
|
||||
|
||||
// 1. Infos Game
|
||||
$stmt = $pdo->prepare("SELECT * FROM games WHERE id = ?");
|
||||
$stmt->execute([$game_id]);
|
||||
$game = $stmt->fetch();
|
||||
|
||||
// 2. Infos Players
|
||||
$stmt = $pdo->prepare("SELECT * FROM players WHERE game_id = ? ORDER BY id ASC");
|
||||
$stmt->execute([$game_id]);
|
||||
$players = $stmt->fetchAll();
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'game' => $game,
|
||||
'players' => $players,
|
||||
'session_player_id' => $_SESSION['current_player_id'] ?? null
|
||||
]);
|
||||
exit;
|
||||
|
||||
case 'get_all_games':
|
||||
// Liste pour l'index
|
||||
$stmt = $pdo->query("SELECT g.*, (SELECT COUNT(*) FROM players WHERE game_id = g.id) as nb_players FROM games g");
|
||||
echo json_encode(['success' => true, 'games' => $stmt->fetchAll()]);
|
||||
exit;
|
||||
|
||||
// --- GAMEPLAY & SCORES ---
|
||||
|
||||
case 'saveScore':
|
||||
// $params contient 'player_id', 'column' (ex: score_brelan), et 'value'
|
||||
$column = $params['column'];
|
||||
$allowed_columns = [
|
||||
'score_1','score_2','score_3','score_4','score_5','score_6',
|
||||
'score_brelan','score_carre','score_full','score_petite_suite',
|
||||
'score_grande_suite','score_yahtzee','score_chance'
|
||||
];
|
||||
|
||||
if (!in_array($column, $allowed_columns)) {
|
||||
echo json_encode(['success' => false, 'error' => 'Colonne invalide']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE players SET $column = ? WHERE id = ?");
|
||||
$stmt->execute([(int)$params['value'], (int)$params['player_id']]);
|
||||
|
||||
// On recalcule le total automatiquement ici ou en JS plus tard
|
||||
echo json_encode(['success' => true]);
|
||||
exit;
|
||||
|
||||
case 'nextTurn':
|
||||
$game_id = (int)$params['game_id'];
|
||||
$current_player_id = (int)$params['player_id'];
|
||||
|
||||
// 1. Retirer le tour au joueur actuel
|
||||
$pdo->prepare("UPDATE players SET is_turn = 0 WHERE id = ?")->execute([$current_player_id]);
|
||||
|
||||
// 2. Trouver le suivant
|
||||
$stmt = $pdo->prepare("SELECT id FROM players WHERE game_id = ? AND id > ? ORDER BY id ASC LIMIT 1");
|
||||
$stmt->execute([$game_id, $current_player_id]);
|
||||
$next = $stmt->fetchColumn();
|
||||
|
||||
if (!$next) {
|
||||
$stmt = $pdo->prepare("SELECT id FROM players WHERE game_id = ? ORDER BY id ASC LIMIT 1");
|
||||
$stmt->execute([$game_id]);
|
||||
$next = $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
$pdo->prepare("UPDATE players SET is_turn = 1 WHERE id = ?")->execute([$next]);
|
||||
echo json_encode(['success' => true, 'next_player_id' => $next]);
|
||||
exit;
|
||||
|
||||
// --- ADMIN ---
|
||||
|
||||
case 'delete_game':
|
||||
$game_id = (int)$params['game_id'];
|
||||
$player_id = $_SESSION['current_player_id'] ?? 0;
|
||||
|
||||
// Vérification admin
|
||||
$stmt = $pdo->prepare("SELECT admin_id FROM games WHERE id = ?");
|
||||
$stmt->execute([$game_id]);
|
||||
$admin_id = $stmt->fetchColumn();
|
||||
|
||||
if ($admin_id == $player_id) {
|
||||
$pdo->prepare("DELETE FROM games WHERE id = ?")->execute([$game_id]);
|
||||
echo json_encode(['success' => true]);
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => 'Action réservée à l\'admin']);
|
||||
}
|
||||
exit;
|
||||
|
||||
default:
|
||||
echo json_encode(['success' => false, 'error' => 'Action inconnue']);
|
||||
exit;
|
||||
}
|
||||
+61
-61
@@ -1,62 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>Configuration - Yahtzee PAF</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='../css/config.css'>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="yahtzee-table config-table">
|
||||
<div class="table-inner">
|
||||
<header class="config-header">
|
||||
<div class="dice-icon">🎲</div>
|
||||
<h1>Nouvelle Partie</h1>
|
||||
</header>
|
||||
|
||||
<form id="config-form">
|
||||
<div class="input-group">
|
||||
<label for="game-name">Nom de la table</label>
|
||||
<input type="text" id="game-name" placeholder="Ex: La Table des Légendes" required>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<label for="player-count">Nombre de joueurs</label>
|
||||
<select id="player-count" onchange="updatePlayerInputs()">
|
||||
<option value="1">1 Joueur (Solo)</option>
|
||||
<option value="2" selected>2 Joueurs</option>
|
||||
<option value="3">3 Joueurs</option>
|
||||
<option value="4">4 Joueurs</option>
|
||||
<option value="5">5 Joueurs</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="players-names-container" class="players-list">
|
||||
<label>Participants & Couleurs</label>
|
||||
|
||||
<div class="player-row">
|
||||
<input type="color" class="color-picker" value="#ff3131">
|
||||
<input type="text" placeholder="Joueur 1" class="player-input">
|
||||
</div>
|
||||
|
||||
<div class="player-row">
|
||||
<input type="color" class="color-picker" value="#d4af37">
|
||||
<input type="text" placeholder="Joueur 2" class="player-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-footer">
|
||||
<button type="button" class="btn-cancel" onclick="window.location.href='../index.html'">Annuler</button>
|
||||
<button type="submit" class="btn-confirm">Lancer les dés !</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src='../js/config.js'></script>
|
||||
</body>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>Configuration - Yahtzee PAF</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='../css/config.css'>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="yahtzee-table config-table">
|
||||
<div class="table-inner">
|
||||
<header class="config-header">
|
||||
<div class="dice-icon">🎲</div>
|
||||
<h1>Nouvelle Partie</h1>
|
||||
</header>
|
||||
|
||||
<form id="config-form">
|
||||
<div class="input-group">
|
||||
<label for="game-name">Nom de la table</label>
|
||||
<input type="text" id="game-name" placeholder="Ex: La Table des Légendes" required>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<label for="player-count">Nombre de joueurs</label>
|
||||
<select id="player-count" onchange="updatePlayerInputs()">
|
||||
<option value="1">1 Joueur (Solo)</option>
|
||||
<option value="2" selected>2 Joueurs</option>
|
||||
<option value="3">3 Joueurs</option>
|
||||
<option value="4">4 Joueurs</option>
|
||||
<option value="5">5 Joueurs</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="players-names-container" class="players-list">
|
||||
<label>Participants & Couleurs</label>
|
||||
|
||||
<div class="player-row">
|
||||
<input type="color" class="color-picker" value="#ff3131">
|
||||
<input type="text" placeholder="Joueur 1" class="player-input">
|
||||
</div>
|
||||
|
||||
<div class="player-row">
|
||||
<input type="color" class="color-picker" value="#d4af37">
|
||||
<input type="text" placeholder="Joueur 2" class="player-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-footer">
|
||||
<button type="button" class="btn-cancel" onclick="window.location.href='../index.html'">Annuler</button>
|
||||
<button type="submit" class="btn-confirm">Lancer les dés !</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src='../js/config.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
+190
-190
@@ -1,191 +1,191 @@
|
||||
:root {
|
||||
--night-blue: radial-gradient(circle, #1a2a6c 0%, #0a1128 100%);
|
||||
--velvet-red: #8e0000;
|
||||
--neon-red: #ff3131;
|
||||
--gold: #d4af37;
|
||||
--gold-light: #f9e27d;
|
||||
--dark-bg: #050505;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--dark-bg);
|
||||
background-image: radial-gradient(circle at center, #0a1128 0%, #020205 100%);
|
||||
color: white;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* --- LA TABLE DE CONFIGURATION --- */
|
||||
.config-table {
|
||||
background: var(--night-blue);
|
||||
border-radius: 60px;
|
||||
border: 12px solid #2d0000;
|
||||
outline: 2px solid #4a0000;
|
||||
padding: 40px;
|
||||
box-shadow: 0 25px 50px rgba(0,0,0,0.9), inset 0 0 60px rgba(0,0,0,0.7);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.config-table::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 10px; left: 10px; right: 10px; bottom: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: 50px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* --- HEADER --- */
|
||||
.config-header {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.dice-icon {
|
||||
font-size: 3rem;
|
||||
filter: drop-shadow(0 0 10px var(--neon-red));
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.config-header h1 {
|
||||
color: var(--gold);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
font-size: 1.8rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* --- FORMULAIRE --- */
|
||||
.input-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.input-group label, .players-list label {
|
||||
color: var(--gold);
|
||||
font-size: 0.9rem;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 8px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="text"], select {
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
border: 2px solid #2d0000;
|
||||
border-radius: 10px;
|
||||
padding: 12px;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
outline: none;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
|
||||
input[type="text"]:focus, select:focus {
|
||||
border-color: var(--neon-red);
|
||||
}
|
||||
|
||||
.players-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
/* --- BOUTONS --- */
|
||||
.button-footer {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.btn-confirm {
|
||||
flex: 2;
|
||||
background: linear-gradient(135deg, #b31217 0%, #e52d27 100%);
|
||||
color: white;
|
||||
border: 2px solid var(--gold);
|
||||
padding: 15px;
|
||||
border-radius: 50px;
|
||||
font-weight: 900;
|
||||
cursor: pointer;
|
||||
text-transform: uppercase;
|
||||
box-shadow: 0 5px 0 #600000;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.btn-confirm:hover {
|
||||
filter: brightness(1.2);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
flex: 1;
|
||||
background: transparent;
|
||||
color: rgba(255,255,255,0.5);
|
||||
border: 2px solid rgba(255,255,255,0.2);
|
||||
padding: 15px;
|
||||
border-radius: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-cancel:hover {
|
||||
color: white;
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
/* Alignement du sélecteur et du texte */
|
||||
.player-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Style du sélecteur de couleur */
|
||||
.color-picker {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
background-color: transparent;
|
||||
border: 2px solid #2d0000;
|
||||
border-radius: 50%; /* On le fait rond comme un jeton */
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.color-picker::-webkit-color-swatch-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.color-picker::-webkit-color-swatch {
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* On ajuste l'input texte pour qu'il prenne le reste de la place */
|
||||
.player-input {
|
||||
flex: 1;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
border: 2px solid #2d0000;
|
||||
border-radius: 10px;
|
||||
padding: 12px;
|
||||
color: white;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.player-input:focus {
|
||||
border-color: var(--neon-red);
|
||||
box-shadow: 0 0 10px rgba(255, 49, 49, 0.3);
|
||||
:root {
|
||||
--night-blue: radial-gradient(circle, #1a2a6c 0%, #0a1128 100%);
|
||||
--velvet-red: #8e0000;
|
||||
--neon-red: #ff3131;
|
||||
--gold: #d4af37;
|
||||
--gold-light: #f9e27d;
|
||||
--dark-bg: #050505;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--dark-bg);
|
||||
background-image: radial-gradient(circle at center, #0a1128 0%, #020205 100%);
|
||||
color: white;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* --- LA TABLE DE CONFIGURATION --- */
|
||||
.config-table {
|
||||
background: var(--night-blue);
|
||||
border-radius: 60px;
|
||||
border: 12px solid #2d0000;
|
||||
outline: 2px solid #4a0000;
|
||||
padding: 40px;
|
||||
box-shadow: 0 25px 50px rgba(0,0,0,0.9), inset 0 0 60px rgba(0,0,0,0.7);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.config-table::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 10px; left: 10px; right: 10px; bottom: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: 50px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* --- HEADER --- */
|
||||
.config-header {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.dice-icon {
|
||||
font-size: 3rem;
|
||||
filter: drop-shadow(0 0 10px var(--neon-red));
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.config-header h1 {
|
||||
color: var(--gold);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
font-size: 1.8rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* --- FORMULAIRE --- */
|
||||
.input-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.input-group label, .players-list label {
|
||||
color: var(--gold);
|
||||
font-size: 0.9rem;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 8px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="text"], select {
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
border: 2px solid #2d0000;
|
||||
border-radius: 10px;
|
||||
padding: 12px;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
outline: none;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
|
||||
input[type="text"]:focus, select:focus {
|
||||
border-color: var(--neon-red);
|
||||
}
|
||||
|
||||
.players-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
/* --- BOUTONS --- */
|
||||
.button-footer {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.btn-confirm {
|
||||
flex: 2;
|
||||
background: linear-gradient(135deg, #b31217 0%, #e52d27 100%);
|
||||
color: white;
|
||||
border: 2px solid var(--gold);
|
||||
padding: 15px;
|
||||
border-radius: 50px;
|
||||
font-weight: 900;
|
||||
cursor: pointer;
|
||||
text-transform: uppercase;
|
||||
box-shadow: 0 5px 0 #600000;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.btn-confirm:hover {
|
||||
filter: brightness(1.2);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
flex: 1;
|
||||
background: transparent;
|
||||
color: rgba(255,255,255,0.5);
|
||||
border: 2px solid rgba(255,255,255,0.2);
|
||||
padding: 15px;
|
||||
border-radius: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-cancel:hover {
|
||||
color: white;
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
/* Alignement du sélecteur et du texte */
|
||||
.player-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Style du sélecteur de couleur */
|
||||
.color-picker {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
background-color: transparent;
|
||||
border: 2px solid #2d0000;
|
||||
border-radius: 50%; /* On le fait rond comme un jeton */
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.color-picker::-webkit-color-swatch-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.color-picker::-webkit-color-swatch {
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* On ajuste l'input texte pour qu'il prenne le reste de la place */
|
||||
.player-input {
|
||||
flex: 1;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
border: 2px solid #2d0000;
|
||||
border-radius: 10px;
|
||||
padding: 12px;
|
||||
color: white;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.player-input:focus {
|
||||
border-color: var(--neon-red);
|
||||
box-shadow: 0 0 10px rgba(255, 49, 49, 0.3);
|
||||
}
|
||||
+62
-62
@@ -1,63 +1,63 @@
|
||||
:root {
|
||||
--night-blue: radial-gradient(circle, #1a2a6c 0%, #0a1128 100%);
|
||||
--gold: #d4af37;
|
||||
--neon-red: #ff3131;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #050505;
|
||||
color: white;
|
||||
font-family: sans-serif;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.yahtzee-table {
|
||||
background: var(--night-blue);
|
||||
border: 10px solid #2d0000;
|
||||
border-radius: 50px;
|
||||
padding: 30px;
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
text-align: center;
|
||||
box-shadow: 0 20px 40px rgba(0,0,0,0.8);
|
||||
}
|
||||
|
||||
.game-header h1 {
|
||||
color: var(--gold);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.players-grid {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
flex-wrap: wrap;
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.player-card {
|
||||
padding: 15px;
|
||||
border-radius: 15px;
|
||||
background: rgba(0,0,0,0.3);
|
||||
border-bottom: 4px solid transparent;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.player-card.active {
|
||||
border-color: #fff;
|
||||
box-shadow: 0 0 15px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
.btn-admin-close {
|
||||
background: transparent;
|
||||
color: var(--neon-red);
|
||||
border: 1px solid var(--neon-red);
|
||||
padding: 5px 15px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
:root {
|
||||
--night-blue: radial-gradient(circle, #1a2a6c 0%, #0a1128 100%);
|
||||
--gold: #d4af37;
|
||||
--neon-red: #ff3131;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #050505;
|
||||
color: white;
|
||||
font-family: sans-serif;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.yahtzee-table {
|
||||
background: var(--night-blue);
|
||||
border: 10px solid #2d0000;
|
||||
border-radius: 50px;
|
||||
padding: 30px;
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
text-align: center;
|
||||
box-shadow: 0 20px 40px rgba(0,0,0,0.8);
|
||||
}
|
||||
|
||||
.game-header h1 {
|
||||
color: var(--gold);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.players-grid {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
flex-wrap: wrap;
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.player-card {
|
||||
padding: 15px;
|
||||
border-radius: 15px;
|
||||
background: rgba(0,0,0,0.3);
|
||||
border-bottom: 4px solid transparent;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.player-card.active {
|
||||
border-color: #fff;
|
||||
box-shadow: 0 0 15px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
.btn-admin-close {
|
||||
background: transparent;
|
||||
color: var(--neon-red);
|
||||
border: 1px solid var(--neon-red);
|
||||
padding: 5px 15px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.debug-zone { margin-top: 40px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; }
|
||||
+201
-201
@@ -1,202 +1,202 @@
|
||||
/* --- VARIABLES YAHTZEE PAF --- */
|
||||
:root {
|
||||
--night-blue: radial-gradient(circle, #1a2a6c 0%, #0a1128 100%);
|
||||
--velvet-red: #8e0000;
|
||||
--neon-red: #ff3131;
|
||||
--gold: #d4af37;
|
||||
--gold-light: #f9e27d;
|
||||
--dark-bg: #050505;
|
||||
--white: #ffffff;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--dark-bg);
|
||||
background-image: radial-gradient(circle at center, #0a1128 0%, #020205 100%);
|
||||
color: var(--white);
|
||||
font-family: 'Segoe UI', Roboto, sans-serif;
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40px 20px;
|
||||
width: 100%;
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
/* --- STYLE DES TABLES --- */
|
||||
.yahtzee-table {
|
||||
position: relative;
|
||||
padding: 35px;
|
||||
border-radius: 80px;
|
||||
/* Bordure Rouge Classe */
|
||||
border: 15px solid #2d0000;
|
||||
box-shadow: 0 25px 50px rgba(0,0,0,0.9), inset 0 0 60px rgba(0,0,0,0.7);
|
||||
width: 100%;
|
||||
outline: 2px solid #4a0000;
|
||||
margin-bottom: 40px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Liseré de finition blanc/bleu */
|
||||
.yahtzee-table::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 12px; left: 12px; right: 12px; bottom: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: 65px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.table-inner {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Table Header (Plus compact) */
|
||||
.table-header {
|
||||
background: #0a1128;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.table-header h1 {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
text-transform: uppercase;
|
||||
font-size: 1rem;
|
||||
letter-spacing: 4px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Style du Logo Texte Néon */
|
||||
.neon-dice {
|
||||
font-size: 3.5rem;
|
||||
font-weight: 900;
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
text-shadow: 0 0 10px var(--neon-red), 0 0 20px var(--neon-red);
|
||||
}
|
||||
|
||||
.neon-dice span {
|
||||
color: var(--gold);
|
||||
text-shadow: 0 0 10px var(--gold);
|
||||
}
|
||||
|
||||
/* Table de Jeu (Bleu Nuit) */
|
||||
.table-main {
|
||||
background: var(--night-blue);
|
||||
}
|
||||
|
||||
.button-center-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px 0 40px 0;
|
||||
}
|
||||
|
||||
/* --- BOUTON ROUGE ET OR --- */
|
||||
.btn-main-create {
|
||||
background: linear-gradient(135deg, #b31217 0%, #e52d27 100%);
|
||||
color: white;
|
||||
padding: 18px 45px;
|
||||
font-weight: 900;
|
||||
font-size: 1.2rem;
|
||||
border-radius: 50px;
|
||||
border: 2px solid var(--gold);
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 8px 0px #600000, 0 15px 20px rgba(0,0,0,0.5);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.btn-main-create:hover {
|
||||
transform: translateY(-3px);
|
||||
filter: brightness(1.2);
|
||||
box-shadow: 0 11px 0px #600000, 0 20px 25px rgba(0,0,0,0.6);
|
||||
}
|
||||
|
||||
.table-main h2 {
|
||||
font-size: 1.1rem;
|
||||
color: var(--gold);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.placeholder-text {
|
||||
color: rgba(255, 255, 255, 0.2);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* --- RESPONSIVE --- */
|
||||
@media (max-width: 600px) {
|
||||
.yahtzee-table { border-radius: 40px; padding: 20px; }
|
||||
.neon-dice { font-size: 2.2rem; }
|
||||
}
|
||||
|
||||
/* Style des lignes de parties */
|
||||
.game-item-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: rgba(26, 42, 108, 0.4); /* Bleu nuit transparent */
|
||||
border: 1px solid rgba(212, 175, 55, 0.3); /* Bordure dorée subtile */
|
||||
margin-bottom: 15px;
|
||||
padding: 15px 25px;
|
||||
border-radius: 15px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.game-item-row:hover {
|
||||
background: rgba(26, 42, 108, 0.7);
|
||||
transform: translateX(5px);
|
||||
border-color: var(--gold, #d4af37);
|
||||
box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
|
||||
}
|
||||
|
||||
.game-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.game-name {
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.game-players-count {
|
||||
font-size: 0.9rem;
|
||||
color: var(--gold, #d4af37);
|
||||
}
|
||||
|
||||
/* Bouton rejoindre */
|
||||
.btn-join {
|
||||
background: transparent;
|
||||
border: 2px solid #ff3131; /* Rouge néon */
|
||||
color: #ff3131;
|
||||
padding: 8px 20px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.btn-join:hover {
|
||||
background: #ff3131;
|
||||
color: #fff;
|
||||
box-shadow: 0 0 15px rgba(255, 49, 49, 0.6);
|
||||
}
|
||||
|
||||
.placeholder-text {
|
||||
font-style: italic;
|
||||
opacity: 0.5;
|
||||
padding: 20px;
|
||||
/* --- VARIABLES YAHTZEE PAF --- */
|
||||
:root {
|
||||
--night-blue: radial-gradient(circle, #1a2a6c 0%, #0a1128 100%);
|
||||
--velvet-red: #8e0000;
|
||||
--neon-red: #ff3131;
|
||||
--gold: #d4af37;
|
||||
--gold-light: #f9e27d;
|
||||
--dark-bg: #050505;
|
||||
--white: #ffffff;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--dark-bg);
|
||||
background-image: radial-gradient(circle at center, #0a1128 0%, #020205 100%);
|
||||
color: var(--white);
|
||||
font-family: 'Segoe UI', Roboto, sans-serif;
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40px 20px;
|
||||
width: 100%;
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
/* --- STYLE DES TABLES --- */
|
||||
.yahtzee-table {
|
||||
position: relative;
|
||||
padding: 35px;
|
||||
border-radius: 80px;
|
||||
/* Bordure Rouge Classe */
|
||||
border: 15px solid #2d0000;
|
||||
box-shadow: 0 25px 50px rgba(0,0,0,0.9), inset 0 0 60px rgba(0,0,0,0.7);
|
||||
width: 100%;
|
||||
outline: 2px solid #4a0000;
|
||||
margin-bottom: 40px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Liseré de finition blanc/bleu */
|
||||
.yahtzee-table::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 12px; left: 12px; right: 12px; bottom: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: 65px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.table-inner {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Table Header (Plus compact) */
|
||||
.table-header {
|
||||
background: #0a1128;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.table-header h1 {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
text-transform: uppercase;
|
||||
font-size: 1rem;
|
||||
letter-spacing: 4px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Style du Logo Texte Néon */
|
||||
.neon-dice {
|
||||
font-size: 3.5rem;
|
||||
font-weight: 900;
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
text-shadow: 0 0 10px var(--neon-red), 0 0 20px var(--neon-red);
|
||||
}
|
||||
|
||||
.neon-dice span {
|
||||
color: var(--gold);
|
||||
text-shadow: 0 0 10px var(--gold);
|
||||
}
|
||||
|
||||
/* Table de Jeu (Bleu Nuit) */
|
||||
.table-main {
|
||||
background: var(--night-blue);
|
||||
}
|
||||
|
||||
.button-center-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px 0 40px 0;
|
||||
}
|
||||
|
||||
/* --- BOUTON ROUGE ET OR --- */
|
||||
.btn-main-create {
|
||||
background: linear-gradient(135deg, #b31217 0%, #e52d27 100%);
|
||||
color: white;
|
||||
padding: 18px 45px;
|
||||
font-weight: 900;
|
||||
font-size: 1.2rem;
|
||||
border-radius: 50px;
|
||||
border: 2px solid var(--gold);
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 8px 0px #600000, 0 15px 20px rgba(0,0,0,0.5);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.btn-main-create:hover {
|
||||
transform: translateY(-3px);
|
||||
filter: brightness(1.2);
|
||||
box-shadow: 0 11px 0px #600000, 0 20px 25px rgba(0,0,0,0.6);
|
||||
}
|
||||
|
||||
.table-main h2 {
|
||||
font-size: 1.1rem;
|
||||
color: var(--gold);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.placeholder-text {
|
||||
color: rgba(255, 255, 255, 0.2);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* --- RESPONSIVE --- */
|
||||
@media (max-width: 600px) {
|
||||
.yahtzee-table { border-radius: 40px; padding: 20px; }
|
||||
.neon-dice { font-size: 2.2rem; }
|
||||
}
|
||||
|
||||
/* Style des lignes de parties */
|
||||
.game-item-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: rgba(26, 42, 108, 0.4); /* Bleu nuit transparent */
|
||||
border: 1px solid rgba(212, 175, 55, 0.3); /* Bordure dorée subtile */
|
||||
margin-bottom: 15px;
|
||||
padding: 15px 25px;
|
||||
border-radius: 15px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.game-item-row:hover {
|
||||
background: rgba(26, 42, 108, 0.7);
|
||||
transform: translateX(5px);
|
||||
border-color: var(--gold, #d4af37);
|
||||
box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
|
||||
}
|
||||
|
||||
.game-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.game-name {
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.game-players-count {
|
||||
font-size: 0.9rem;
|
||||
color: var(--gold, #d4af37);
|
||||
}
|
||||
|
||||
/* Bouton rejoindre */
|
||||
.btn-join {
|
||||
background: transparent;
|
||||
border: 2px solid #ff3131; /* Rouge néon */
|
||||
color: #ff3131;
|
||||
padding: 8px 20px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.btn-join:hover {
|
||||
background: #ff3131;
|
||||
color: #fff;
|
||||
box-shadow: 0 0 15px rgba(255, 49, 49, 0.6);
|
||||
}
|
||||
|
||||
.placeholder-text {
|
||||
font-style: italic;
|
||||
opacity: 0.5;
|
||||
padding: 20px;
|
||||
}
|
||||
+34
-34
@@ -1,35 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>Partie - Yahtzee PAF</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='../css/game.css'>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="yahtzee-table table-main">
|
||||
<div class="table-inner">
|
||||
<header class="game-header">
|
||||
<h1 id="display-game-name">Chargement...</h1>
|
||||
<div id="admin-controls"></div>
|
||||
</header>
|
||||
|
||||
<div class="game-status">
|
||||
<h3>Joueurs à table :</h3>
|
||||
<div id="players-list" class="players-grid">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="debug-zone">
|
||||
<button class="btn-main-create" onclick="window.location.href='../index.html'">Retour Accueil</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src='../js/game.js'></script>
|
||||
</body>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>Partie - Yahtzee PAF</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='../css/game.css'>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="yahtzee-table table-main">
|
||||
<div class="table-inner">
|
||||
<header class="game-header">
|
||||
<h1 id="display-game-name">Chargement...</h1>
|
||||
<div id="admin-controls"></div>
|
||||
</header>
|
||||
|
||||
<div class="game-status">
|
||||
<h3>Joueurs à table :</h3>
|
||||
<div id="players-list" class="players-grid">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="debug-zone">
|
||||
<button class="btn-main-create" onclick="window.location.href='../index.html'">Retour Accueil</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src='../js/game.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
+42
-42
@@ -1,43 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>Accueil - Yahtzee PAF</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='css/index.css'>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.png">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<header class="yahtzee-table table-header">
|
||||
<div class="table-inner">
|
||||
<h1>Welcome to</h1>
|
||||
<div class="logo-wrapper">
|
||||
<div class="neon-dice">Yahtzee <span>PAF</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="tables-hall">
|
||||
<div class="yahtzee-table table-main">
|
||||
<div class="table-inner">
|
||||
<div class="button-center-wrapper">
|
||||
<button class="btn-main-create" onclick="window.location.href='config/index.html'">
|
||||
Lancer une partie
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<h2>Parties en attente de joueurs</h2>
|
||||
<div id="games_list">
|
||||
<p class="placeholder-text">Aucune table ouverte pour le moment...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script src='js/index.js'></script>
|
||||
</body>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>Accueil - Yahtzee PAF</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='css/index.css'>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.png">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<header class="yahtzee-table table-header">
|
||||
<div class="table-inner">
|
||||
<h1>Welcome to</h1>
|
||||
<div class="logo-wrapper">
|
||||
<div class="neon-dice">Yahtzee <span>PAF</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="tables-hall">
|
||||
<div class="yahtzee-table table-main">
|
||||
<div class="table-inner">
|
||||
<div class="button-center-wrapper">
|
||||
<button class="btn-main-create" onclick="window.location.href='config/index.html'">
|
||||
Lancer une partie
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<h2>Parties en attente de joueurs</h2>
|
||||
<div id="games_list">
|
||||
<p class="placeholder-text">Aucune table ouverte pour le moment...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script src='js/index.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
+100
-100
@@ -1,101 +1,101 @@
|
||||
const defaultColors = ['#ff3131', '#d4af37', '#1a2a6c', '#00ff41', '#ff00ff'];
|
||||
|
||||
function updatePlayerInputs() {
|
||||
const count = document.getElementById('player-count').value;
|
||||
const container = document.getElementById('players-names-container');
|
||||
|
||||
// On vide tout sauf le label
|
||||
container.innerHTML = '<label>Participants & Couleurs</label>';
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
const row = document.createElement('div');
|
||||
row.className = 'player-row';
|
||||
|
||||
// Création du sélecteur de couleur
|
||||
const colorInput = document.createElement('input');
|
||||
colorInput.type = 'color';
|
||||
colorInput.className = 'color-picker';
|
||||
colorInput.value = defaultColors[i] || '#ffffff'; // Couleur par défaut
|
||||
|
||||
// Création du champ nom
|
||||
const nameInput = document.createElement('input');
|
||||
nameInput.type = 'text';
|
||||
nameInput.placeholder = 'Joueur ' + (i + 1);
|
||||
nameInput.className = 'player-input';
|
||||
|
||||
// Assemblage
|
||||
row.appendChild(colorInput);
|
||||
row.appendChild(nameInput);
|
||||
container.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
async function SqlRequest(action, params = {}) {
|
||||
try {
|
||||
const response = await fetch('../RequestsHandler.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: action,
|
||||
params: params
|
||||
})
|
||||
});
|
||||
|
||||
const resultat = await response.json();
|
||||
|
||||
if (resultat.success) {
|
||||
return resultat;
|
||||
} else {
|
||||
console.error("Erreur :", resultat.error);
|
||||
}
|
||||
} catch (erreur) {
|
||||
console.error("Erreur de communication :", erreur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const loginForm = document.getElementById('config-form'); // Vérifie bien que l'ID match ton HTML
|
||||
|
||||
loginForm.addEventListener('submit', async function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// 1. Récupération des infos de base
|
||||
const gameName = document.getElementById('game-name').value;
|
||||
const playerRows = document.querySelectorAll('.player-row');
|
||||
// 2. Création de la partie dans la BDD
|
||||
let response = await SqlRequest('createGame', {
|
||||
game_name: gameName
|
||||
});
|
||||
|
||||
if (response && response.success) {
|
||||
const gameId = parseInt(response.game_id);
|
||||
|
||||
// 3. Boucle sur les lignes de joueurs pour les ajouter un par un
|
||||
for (let i = 0; i < playerRows.length; i++) {
|
||||
const name = playerRows[i].querySelector('.player-input').value || `Joueur ${i + 1}`;
|
||||
const color = playerRows[i].querySelector('.color-picker').value;
|
||||
|
||||
// Le premier joueur (index 0) sera l'admin et commencera le tour (is_turn: 1)
|
||||
const isAdmin = (i === 0);
|
||||
const isTurn = (i === 0) ? 1 : 0;
|
||||
|
||||
await SqlRequest('addPlayer', {
|
||||
game_id: gameId,
|
||||
name: name,
|
||||
color: color,
|
||||
is_turn: isTurn,
|
||||
is_admin: isAdmin // Paramètre utilisé par le PHP pour l'admin_id
|
||||
});
|
||||
}
|
||||
|
||||
// 4. Redirection vers la table de jeu
|
||||
console.log("Partie créée avec succès, ID:", gameId);
|
||||
window.location.href = '../game/index.html?game_id=' + gameId;
|
||||
|
||||
} else {
|
||||
console.error("Erreur lors de la création de la partie :", response?.error);
|
||||
alert("Erreur : " + (response?.error || "Impossible de joindre le serveur"));
|
||||
}
|
||||
const defaultColors = ['#ff3131', '#d4af37', '#1a2a6c', '#00ff41', '#ff00ff'];
|
||||
|
||||
function updatePlayerInputs() {
|
||||
const count = document.getElementById('player-count').value;
|
||||
const container = document.getElementById('players-names-container');
|
||||
|
||||
// On vide tout sauf le label
|
||||
container.innerHTML = '<label>Participants & Couleurs</label>';
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
const row = document.createElement('div');
|
||||
row.className = 'player-row';
|
||||
|
||||
// Création du sélecteur de couleur
|
||||
const colorInput = document.createElement('input');
|
||||
colorInput.type = 'color';
|
||||
colorInput.className = 'color-picker';
|
||||
colorInput.value = defaultColors[i] || '#ffffff'; // Couleur par défaut
|
||||
|
||||
// Création du champ nom
|
||||
const nameInput = document.createElement('input');
|
||||
nameInput.type = 'text';
|
||||
nameInput.placeholder = 'Joueur ' + (i + 1);
|
||||
nameInput.className = 'player-input';
|
||||
|
||||
// Assemblage
|
||||
row.appendChild(colorInput);
|
||||
row.appendChild(nameInput);
|
||||
container.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
async function SqlRequest(action, params = {}) {
|
||||
try {
|
||||
const response = await fetch('../RequestsHandler.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: action,
|
||||
params: params
|
||||
})
|
||||
});
|
||||
|
||||
const resultat = await response.json();
|
||||
|
||||
if (resultat.success) {
|
||||
return resultat;
|
||||
} else {
|
||||
console.error("Erreur :", resultat.error);
|
||||
}
|
||||
} catch (erreur) {
|
||||
console.error("Erreur de communication :", erreur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const loginForm = document.getElementById('config-form'); // Vérifie bien que l'ID match ton HTML
|
||||
|
||||
loginForm.addEventListener('submit', async function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// 1. Récupération des infos de base
|
||||
const gameName = document.getElementById('game-name').value;
|
||||
const playerRows = document.querySelectorAll('.player-row');
|
||||
// 2. Création de la partie dans la BDD
|
||||
let response = await SqlRequest('createGame', {
|
||||
game_name: gameName
|
||||
});
|
||||
|
||||
if (response && response.success) {
|
||||
const gameId = parseInt(response.game_id);
|
||||
|
||||
// 3. Boucle sur les lignes de joueurs pour les ajouter un par un
|
||||
for (let i = 0; i < playerRows.length; i++) {
|
||||
const name = playerRows[i].querySelector('.player-input').value || `Joueur ${i + 1}`;
|
||||
const color = playerRows[i].querySelector('.color-picker').value;
|
||||
|
||||
// Le premier joueur (index 0) sera l'admin et commencera le tour (is_turn: 1)
|
||||
const isAdmin = (i === 0);
|
||||
const isTurn = (i === 0) ? 1 : 0;
|
||||
|
||||
await SqlRequest('addPlayer', {
|
||||
game_id: gameId,
|
||||
name: name,
|
||||
color: color,
|
||||
is_turn: isTurn,
|
||||
is_admin: isAdmin // Paramètre utilisé par le PHP pour l'admin_id
|
||||
});
|
||||
}
|
||||
|
||||
// 4. Redirection vers la table de jeu
|
||||
console.log("Partie créée avec succès, ID:", gameId);
|
||||
window.location.href = '../game/index.html?game_id=' + gameId;
|
||||
|
||||
} else {
|
||||
console.error("Erreur lors de la création de la partie :", response?.error);
|
||||
alert("Erreur : " + (response?.error || "Impossible de joindre le serveur"));
|
||||
}
|
||||
});
|
||||
+76
-76
@@ -1,77 +1,77 @@
|
||||
async function SqlRequest(action, params = {}) {
|
||||
try {
|
||||
const response = await fetch('../RequestsHandler.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: action,
|
||||
params: params
|
||||
})
|
||||
});
|
||||
|
||||
const resultat = await response.json();
|
||||
|
||||
if (resultat.success) {
|
||||
return resultat;
|
||||
} else {
|
||||
console.error("Erreur :", resultat.error);
|
||||
}
|
||||
} catch (erreur) {
|
||||
console.error("Erreur de communication :", erreur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const gameId = urlParams.get('game_id');
|
||||
|
||||
if (!gameId) {
|
||||
alert("ID de partie manquant");
|
||||
window.location.href = '../index.html';
|
||||
return;
|
||||
}
|
||||
|
||||
// Récupération des données via le RequestsHandler
|
||||
const response = await SqlRequest('getGameData', { game_id: gameId });
|
||||
|
||||
if (response && response.success) {
|
||||
const game = response.game;
|
||||
const players = response.players;
|
||||
const sessionPlayerId = response.session_player_id;
|
||||
|
||||
// 1. Nom de la partie
|
||||
document.getElementById('display-game-name').innerText = game.game_name;
|
||||
|
||||
// 2. Bouton Admin (si le joueur actuel est l'admin)
|
||||
if (game.admin_id == sessionPlayerId) {
|
||||
const adminDiv = document.getElementById('admin-controls');
|
||||
adminDiv.innerHTML = `<button class="btn-admin-close" onclick="closeGame(${gameId})">Fermer la table</button>`;
|
||||
}
|
||||
|
||||
// 3. Liste des joueurs
|
||||
const listContainer = document.getElementById('players-list');
|
||||
players.forEach(p => {
|
||||
const card = document.createElement('div');
|
||||
card.className = `player-card ${p.is_turn == 1 ? 'active' : ''}`;
|
||||
card.style.borderBottomColor = p.player_color;
|
||||
card.innerHTML = `
|
||||
<div style="color: ${p.player_color}; font-weight: bold;">${p.player_name}</div>
|
||||
<small>${p.is_turn == 1 ? '🎲 En train de jouer' : 'En attente'}</small>
|
||||
`;
|
||||
listContainer.appendChild(card);
|
||||
});
|
||||
|
||||
} else {
|
||||
console.error("Erreur chargement:", response?.error);
|
||||
}
|
||||
});
|
||||
|
||||
async function closeGame(id) {
|
||||
if(confirm("Voulez-vous fermer cette table ?")){
|
||||
const res = await SqlRequest('delete_game', { game_id: id });
|
||||
if(res.success) window.location.href = '../index.html';
|
||||
}
|
||||
async function SqlRequest(action, params = {}) {
|
||||
try {
|
||||
const response = await fetch('../RequestsHandler.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: action,
|
||||
params: params
|
||||
})
|
||||
});
|
||||
|
||||
const resultat = await response.json();
|
||||
|
||||
if (resultat.success) {
|
||||
return resultat;
|
||||
} else {
|
||||
console.error("Erreur :", resultat.error);
|
||||
}
|
||||
} catch (erreur) {
|
||||
console.error("Erreur de communication :", erreur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const gameId = urlParams.get('game_id');
|
||||
|
||||
if (!gameId) {
|
||||
alert("ID de partie manquant");
|
||||
window.location.href = '../index.html';
|
||||
return;
|
||||
}
|
||||
|
||||
// Récupération des données via le RequestsHandler
|
||||
const response = await SqlRequest('getGameData', { game_id: gameId });
|
||||
|
||||
if (response && response.success) {
|
||||
const game = response.game;
|
||||
const players = response.players;
|
||||
const sessionPlayerId = response.session_player_id;
|
||||
|
||||
// 1. Nom de la partie
|
||||
document.getElementById('display-game-name').innerText = game.game_name;
|
||||
|
||||
// 2. Bouton Admin (si le joueur actuel est l'admin)
|
||||
if (game.admin_id == sessionPlayerId) {
|
||||
const adminDiv = document.getElementById('admin-controls');
|
||||
adminDiv.innerHTML = `<button class="btn-admin-close" onclick="closeGame(${gameId})">Fermer la table</button>`;
|
||||
}
|
||||
|
||||
// 3. Liste des joueurs
|
||||
const listContainer = document.getElementById('players-list');
|
||||
players.forEach(p => {
|
||||
const card = document.createElement('div');
|
||||
card.className = `player-card ${p.is_turn == 1 ? 'active' : ''}`;
|
||||
card.style.borderBottomColor = p.player_color;
|
||||
card.innerHTML = `
|
||||
<div style="color: ${p.player_color}; font-weight: bold;">${p.player_name}</div>
|
||||
<small>${p.is_turn == 1 ? '🎲 En train de jouer' : 'En attente'}</small>
|
||||
`;
|
||||
listContainer.appendChild(card);
|
||||
});
|
||||
|
||||
} else {
|
||||
console.error("Erreur chargement:", response?.error);
|
||||
}
|
||||
});
|
||||
|
||||
async function closeGame(id) {
|
||||
if(confirm("Voulez-vous fermer cette table ?")){
|
||||
const res = await SqlRequest('delete_game', { game_id: id });
|
||||
if(res.success) window.location.href = '../index.html';
|
||||
}
|
||||
}
|
||||
+41
-41
@@ -1,42 +1,42 @@
|
||||
async function SqlRequest(action, params = {}) {
|
||||
try {
|
||||
const response = await fetch('RequestsHandler.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ action: action, params: params })
|
||||
});
|
||||
return await response.json();
|
||||
} catch (erreur) {
|
||||
console.error("Erreur de communication :", erreur);
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const gamesListContainer = document.getElementById('games_list');
|
||||
|
||||
// On récupère les parties via le handler
|
||||
const result = await SqlRequest('get_all_games');
|
||||
|
||||
if (result && result.success && result.games.length > 0) {
|
||||
// On vide le placeholder
|
||||
gamesListContainer.innerHTML = '';
|
||||
|
||||
result.games.forEach(game => {
|
||||
const gameElement = document.createElement('div');
|
||||
gameElement.className = 'game-item-row';
|
||||
|
||||
gameElement.innerHTML = `
|
||||
<div class="game-info">
|
||||
<span class="game-name">${game.game_name}</span>
|
||||
<span class="game-players-count">${game.nb_players} Joueurs</span>
|
||||
</div>
|
||||
<button class="btn-join" onclick="window.location.href='game/index.html?game_id=${game.id}'">
|
||||
Rejoindre
|
||||
</button>
|
||||
`;
|
||||
gamesListContainer.appendChild(gameElement);
|
||||
});
|
||||
} else {
|
||||
gamesListContainer.innerHTML = '<p class="placeholder-text">Aucune table ouverte pour le moment...</p>';
|
||||
}
|
||||
async function SqlRequest(action, params = {}) {
|
||||
try {
|
||||
const response = await fetch('RequestsHandler.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ action: action, params: params })
|
||||
});
|
||||
return await response.json();
|
||||
} catch (erreur) {
|
||||
console.error("Erreur de communication :", erreur);
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const gamesListContainer = document.getElementById('games_list');
|
||||
|
||||
// On récupère les parties via le handler
|
||||
const result = await SqlRequest('get_all_games');
|
||||
|
||||
if (result && result.success && result.games.length > 0) {
|
||||
// On vide le placeholder
|
||||
gamesListContainer.innerHTML = '';
|
||||
|
||||
result.games.forEach(game => {
|
||||
const gameElement = document.createElement('div');
|
||||
gameElement.className = 'game-item-row';
|
||||
|
||||
gameElement.innerHTML = `
|
||||
<div class="game-info">
|
||||
<span class="game-name">${game.game_name}</span>
|
||||
<span class="game-players-count">${game.nb_players} Joueurs</span>
|
||||
</div>
|
||||
<button class="btn-join" onclick="window.location.href='game/index.html?game_id=${game.id}'">
|
||||
Rejoindre
|
||||
</button>
|
||||
`;
|
||||
gamesListContainer.appendChild(gameElement);
|
||||
});
|
||||
} else {
|
||||
gamesListContainer.innerHTML = '<p class="placeholder-text">Aucune table ouverte pour le moment...</p>';
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user