Deuxième essaie
continuous-integration/drone/push Build is passing Details

ServeurDeTest
Noé GARNIER 3 years ago
parent 2b618ded52
commit 09f5cc7f92

@ -28,6 +28,9 @@ class UserController
case "goToNext": case "goToNext":
$this->goToNext(); $this->goToNext();
break; break;
case "goToGame":
$this->goToGame();
break;
case "enigmeEnded": case "enigmeEnded":
$this->enigmeEnded(); $this->enigmeEnded();
break; break;
@ -193,15 +196,14 @@ class UserController
$_SESSION['idPartie'] = $idPartie; $_SESSION['idPartie'] = $idPartie;
$lesJoueurs = $model->getLesJoueurs($idPartie); $lesJoueurs = $model->getLesJoueurs($idPartie);
if($etat == 1){ if($etat == 1){
// header("Location: index.php?action=launchGame"); header("Location: index.php?action=goToGame&idPartie=" . $idPartie . "&index=1");
$this->goToGame($idPartie,1);
} }
else{ else{
while ($etat == 0){ while ($etat == 0){
sleep(5); sleep(5);
$etat = $model->getEtatPartie($idPartie); $etat = $model->getEtatPartie($idPartie);
} }
$this->goToGame($idPartie,1); header("Location: index.php?action=goToGame&idPartie=" . $idPartie . "&index=1");
} }
} catch (Exception $e) { } catch (Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
@ -209,11 +211,13 @@ class UserController
} }
} }
public function goToGame(int $idPartie, int $index){ public function goToGame(){
try { try {
global $rep, $vues, $error; global $rep, $vues, $error;
$model = new UserModel(); $model = new UserModel();
$utilisateur = $_SESSION['utilisateur']; $utilisateur = $_SESSION['utilisateur'];
$idPartie = $_GET['idPartie'];
$index = $_GET['index'];
$enigme = $model->getEnigmebyPartieIdAndIndex($idPartie, $index); $enigme = $model->getEnigmebyPartieIdAndIndex($idPartie, $index);
$model->resoudreEnigmeMulti($utilisateur, $enigme->getIdEnigme(), $idPartie,); $model->resoudreEnigmeMulti($utilisateur, $enigme->getIdEnigme(), $idPartie,);
$code = $model->getCode($utilisateur->getEmail(), $enigme->getIdEnigme()); $code = $model->getCode($utilisateur->getEmail(), $enigme->getIdEnigme());

Loading…
Cancel
Save