Merge branch 'master' of https://codefirst.iut.uca.fr/git/nathan.boileau/Scripted
continuous-integration/drone/push Build is passing Details

ServeurDeTest
nathan boileau 2 years ago
commit ae626336e0

@ -66,7 +66,8 @@ class PartieGateway
$query = "SELECT p.id
FROM Partie p, Participer pa
WHERE pa.etat=0
AND pa.partie=p.id";
AND pa.partie=p.id
LIMIT 1";
$this->con->executeQuery($query);
$results = $this->con->getResults();
return $results[0]['id'];

@ -205,12 +205,10 @@ class UserController
require($rep . $vues['queue']);
$model = new UserModel();
$model->addToQueue();
$usergroup = $model->findUserGroup();
echo
'<script>
socket.on("launchGame", () => {
launchGame();
});
io.to($userGroup).emit("launchGame");
'<script>
io.to($userGroup).emit("launchGame");
<script/>';
} catch (Exception $e) {
$error = $e->getMessage();

@ -112,7 +112,7 @@ class UtilisateurGateway
public function queueFilled(){
$query = "SELECT count(*) FROM Participer WHERE etat=0";
$this->con->executeQuery($query);
if ($this->con->getResults()[0]['count(*)'] >= 4)
if ($this->con->getResults()[0]['count(*)'] >= 2)
return True;
else
return False;

@ -44,7 +44,7 @@ class Partie
}
/**
* @param array $datePartie
* @param dateTime $datePartie
*/
public function setDatePartie(dateTime $datePartie): void
{

@ -25,11 +25,15 @@ class UserModel
public function addToQueue()
{
echo '1';
var_dump($this->utilisateur_gateway->isAlreadyInQueue($_SESSION['utilisateur']));
if ($this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur'])) {
var_dump($this->utilisateur_gateway->queueFilled());
if($this->utilisateur_gateway->queueFilled())
{
$_REQUEST['action']='launchGame';
var_dump($_REQUEST['action']);
}
return;
}
echo '2';
if (!$this->partie_gateway->partieInQueueExists()) {
@ -55,6 +59,10 @@ class UserModel
</script>';
}
public function findUserGroup() : int {
return $this->partie_gateway->findPartieInQueue();
}
public function launchGame()
{
$this->utilisateur_gateway->launchGame($_SESSION['utilisateur']);

@ -3,5 +3,6 @@
<!--script src="/root/node_modules/socket.io"></script-->
<script src="C:\wamp64\www\Scripted\node_modules/socket.io"></script>
<script src="C:\wamp64\www\Scripted\server.js"></script>
vous êtes dans la partie
</body>
</html>
Loading…
Cancel
Save