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