Add sincronizacion de jugadores en partida

This commit is contained in:
2026-10-02 10:40:01 +02:00
parent 9488d7cee7
commit 3856db81ef
5 changed files with 278 additions and 82 deletions
+40 -6
View File
@@ -164,7 +164,7 @@ switch ($_POST['orden']) {
break;
}
/*
/*
* ==========================================
* 3. INSERTAMOS LOS EQUIPOS CON SU PARTIDA EN EQUIPOXPARTIDA
* ==========================================
@@ -220,9 +220,9 @@ switch ($_POST['orden']) {
* 5. ASIGNAMOS 10 PREGUNTAS ALEATORIAS A LA PARTIDA
* ==========================================
*/
// Obtenemos todos los IDs de las preguntas
$listaPreguntas = Pregunta::getTodosIds();
$totalPreguntas = count($listaPreguntas);
@@ -246,7 +246,7 @@ switch ($_POST['orden']) {
// Asignamos el ID real de la pregunta a la partida
$partida->asignarPregunta($idPreguntaAleatoria);
}
}//fin shile
} //fin shile
/*
@@ -795,13 +795,47 @@ switch ($_POST['orden']) {
*/
$resultado = $partida->iniciar();
$resultado = $partida->iniciarPartida();
echo json_encode($resultado);
break;
case 'comprobarInicio':
if (!isset($_POST['idPartida'])) {
echo json_encode([
'error' => 'No se ha indicado la partida.'
]);
break;
}
$partida = new Partida();
$partida->idPartida =
intval($_POST['idPartida']);
$datosPartida = $partida->buscar();
if (!$datosPartida || isset($datosPartida['error'])) {
echo json_encode([
'error' => 'La partida no existe.'
]);
break;
}
echo json_encode([
'iniciada' => $datosPartida['fechaInicio'] !== null
]);
break;
// OBTENER LA PREGUNTA ACTUAL
@@ -933,7 +967,7 @@ switch ($_POST['orden']) {
) {
echo json_encode([
'error' => 'Faltan datos para registrar la respuesta.'
'error' => 'Faltan datos para registrar la respuestadd.'
]);
break;