Commit 3561e1d7 authored by etienne912's avatar etienne912
Browse files

commit après une heure de debug

parent d17c6bd0
......@@ -2,6 +2,7 @@
require_once PATH_CONTROLEURS . '/ControleurAuthentification.php';
require_once PATH_CONTROLEURS . '/ControleurJeu.php';
require_once PATH_CONTROLEURS . '/ControleurStatistiques.php';
require_once PATH_MODELES . '/Villes.php';
class Routeur {
......@@ -10,9 +11,8 @@ class Routeur {
private $ControleurStatistiques;
public function __construct() {
$this->ControleurAuthentification = new ControleurAuthentification();
$this->ControleurJeu = new ControleurJeu();
$this->ControleurStatistiques = new ControleurStatistiques();
// $this->ControleurAuthentification = new ControleurAuthentification();
// $this->ControleurStatistiques = new ControleurStatistiques();
}
// Redirige un utilisateur
......@@ -20,18 +20,27 @@ class Routeur {
//Si on est connecté
//TODO:Enlever $_GET['connected'] qui permet de bypass l'authentification pour les tests
if($_GET["deconnection"]){
if (isset($_SESSION["villes"])) {
$this->ControleurJeu = new ControleurJeu(unserialize($_SESSION["villes"]));
} else {
$_SESSION["villes"] = serialize(new Villes());
$this->ControleurJeu = unserialize($_SESSION["villes"]);
}
if ($_GET["deconnection"]) {
unset($_SESSION['Auth']);
}
if (isset($_SESSION['Auth']) || isset($_GET['connected'])) {
if(isset($_GET['connected'])){
$_SESSION["Auth"] = true;
}
if (isset($_SESSION['Auth'])) {
if (isset($_POST['stats'])) {
$this->ControleurStatistiques->statistiques();
}
$this->ControleurJeu->jeu();
} else {
$this->ControleurAuthentification->demandeAuthentification();
......
<?php
require_once PATH_VUES . "/VueJeu.php";
require_once PATH_MODELES . "/ModeleJeu.php";
require_once PATH_MODELES . "/Ville.php";
require_once PATH_MODELES . "/Villes.php";
......@@ -8,15 +7,16 @@ require_once PATH_MODELES . "/Villes.php";
class ControleurJeu {
private $vue;
private $modele;
private $villes;
function __construct() {
function __construct($villes) {
$this->vue = new VueJeu();
$this->villes = new Villes();
$this->villes = $villes;
}
function jeu() {
$this->vue->afficherJeu();
$this->vue->afficherJeu($this->villes);
}
function lier($villeAX,$villeAY,$villeBX,$villeBY){
......
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
body {
padding: 0;
margin: 0;
box-sizing: border-box;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: #111;
}
.conteneur {
}
.jeu {
width: 500px;
height: 500px;
margin: 0 auto;
background: darkgray;
border: 1px solid #111111;
}
footer {
height: 100px;
padding: 10px;
background: lightslategrey;
}
table {
width: 100%;
height: 100%;
}
tr {
height: auto;
width: auto;
}
td {
height: 50px;
width: 50px;
box-sizing: border-box;
margin: 5px 5px;
padding: 0 0;
display: table-cell;
vertical-align: inherit;
border-radius: 100%;
}
td > a {
display: flex;
vertical-align: auto;
box-sizing: border-box;
margin: auto auto;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
text-decoration: none;
font-size: large;
font-weight: bold;
color: black;
}
td.show {
border: 1px solid black;
background-color: #f5ffbf;
}
td.active {
border: 1px solid black;
background-color: #00ff02;
}
td.activeMauvais {
border: 1px solid black;
background-color: #ff2742;
}
\ No newline at end of file
<?php
class ModeleJeu {
public function __construct() {
}
}
?>
......@@ -58,6 +58,5 @@ class Ville {
}
//il faut ici implémenter les méthodes qui permettent de lier des villes entre elles, ...
}
?>
\ No newline at end of file
<?php
// cette classe ne doit pas être modifiée
require "Ville.php";
//require "Ville.php";
class Villes {
......
<?php
require_once "modeles/Villes.php";
class VueJeu{
class VueJeu {
function afficherJeu(){
header("Content-type: text/html; charset=utf-8");
?>
<html>
<body>
<br/>
<h1>Jeu du Bridges</h1>
function afficherJeu($villes) {
header("Content-type: text/html; charset=utf-8");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Jeu du Bridges</title>
<link href="./master.css" rel="stylesheet" type="text/css">
</head>
<body>
<br/>
<br/>
<?php
}
<nav>
<ul>
<li><a href="index.php">Accueil</a></li>
<li><a href="index.php?page=profil">Mon profil</a></li>
<li><a href="index.php?page=leaderboard">Leaderboard</a></li>
<li style="float:right"><a href="index.php?deconnection=true">Déconnection</a></li>
</ul>
</nav>
<br>
<h1>Jeux du Bridges</h1><br>
<div class="conteneur">
<div class="jeu">
<table>
<?php
$actX = isset($_GET["actX"]) ? $_GET["actX"] :-1;
$actY = isset($_GET["actY"]) ? $_GET["actY"] :-1;
$actMauvX = isset($_GET["actMauvX"]) ? $_GET["actMauvX"] :-1;
$actMauvY = isset($_GET["actMauvY"]) ? $_GET["actMauvY"] :-1;
$actLierX = isset($_GET["actLierX"]) ? $_GET["actLierX"] :-1;
$actLierY = isset($_GET["actLierY"]) ? $_GET["actLierY"] :-1;
for ($i = 0; $i <= 6; ++$i) {
echo "<tr>";
for ($j = 0; $j <= 6; ++$j) {
if ($villes->existe($i, $j)) {
if ($actX != -1 && $actY != -1) {
if ($i == $actX && $j == $actY) {
echo "<td class='active'>";
echo "<a href='index.php'>" . $villes->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
} else if ($i == $actX || $j == $actY) {
echo "<td class='show'>";
echo "<a href='index.php?&actX=$actX&actY=$actY&actLierX=$i&actLierY=$j'>" . $villes->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
} else {
echo "<td class='show'>";
echo "<a href='index.php?actMauvX=$i&actMauvY=$j'>" . $villes->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
}
} else {
if ($i == $actMauvX && $j == $actMauvY) {
echo "<td class='activeMauvais'>";
} else {
echo "<td class='show'>";
}
echo "<a href='index.php?actX=$i&actY=$j'>" . $villes->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
}
} else {
echo "<td class='hidden'>";
echo " ";
echo "</td>";
}
}
echo "</tr>";
}
?>
</table>
</div>
</div>
<br>
<br>
<br>
<br>
<br>
<footer>
<p>Créé par Johann Bourzanel et Étienne LÉCRIVAIN</p>
</footer>
</body>
</html>
<?php
}
}
?>
......@@ -32,14 +32,46 @@
$testVille = new Villes();
for ($i = 0; $i <= 6; $i++) {
$actX = isset($_GET["actX"]) ? $_GET["actX"] :-1;
$actY = isset($_GET["actY"]) ? $_GET["actY"] :-1;
$actMauvX = isset($_GET["actMauvX"]) ? $_GET["actMauvX"] :-1;
$actMauvY = isset($_GET["actMauvY"]) ? $_GET["actMauvY"] :-1;
$actLierX = isset($_GET["actLierX"]) ? $_GET["actLierX"] :-1;
$actLierY = isset($_GET["actLierY"]) ? $_GET["actLierY"] :-1;
for ($i = 0; $i <= 6; ++$i) {
echo "<tr>";
for ($j = 0; $j <= 6; $j++) {
for ($j = 0; $j <= 6; ++$j) {
if ($testVille->existe($i, $j)) {
echo "<td class='show'>";
echo "<a class='' href='index.php'>" . $testVille->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
if ($actX != -1 && $actY != -1) {
if ($i == $actX && $j == $actY) {
echo "<td class='active'>";
echo "<a href='TestJeux.php'>" . $testVille->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
} else if ($i == $actX || $j == $actY) {
echo "<td class='show'>";
echo "<a href='TestJeux.php?&actX=$actX&actY=$actY&actLierX=$i&actLierY=$j'>" . $testVille->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
} else {
echo "<td class='show'>";
echo "<a href='TestJeux.php?actMauvX=$i&actMauvY=$j'>" . $testVille->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
}
} else {
if ($i == $actMauvX && $j == $actMauvY) {
echo "<td class='activeMauvais'>";
} else {
echo "<td class='show'>";
}
echo "<a href='TestJeux.php?actX=$i&actY=$j'>" . $testVille->getVille($i, $j)->getNombrePontsMax();
echo "</td>";
}
} else {
echo "<td class='hidden'>";
echo " ";
......@@ -68,7 +100,7 @@
<footer>
<p>Créé par Johann Bourzanel et Etienne LÉCRIVAIN</p>
<p>Créé par Johann Bourzanel et Étienne LÉCRIVAIN</p>
</footer>
......
......@@ -57,37 +57,43 @@ tr {
width: auto;
}
td.show {
height: 40px;
width: 40px;
td {
height: 50px;
width: 50px;
box-sizing: border-box;
margin: 5px 5px;
}
td.hidden {
height: 40px;
width: 40px;
padding: 0 0;
display: table-cell;
vertical-align: inherit;
border-radius: 100%;
margin: 5px 5px;
}
td > a {
display: flex;
vertical-align: auto;
box-sizing: border-box;
margin: auto auto;
align-content: center;
border: 1px solid black;
border-radius: 100%;
padding: 40px;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
text-decoration: none;
font-size: large;
font-weight: bold;
color: black;
}
td > a.show {
background-color: #ffffff;
td.show {
border: 1px solid black;
background-color: #f5ffbf;
}
td > a.active {
td.active {
border: 1px solid black;
background-color: #00ff02;
}
td.activeMauvais {
border: 1px solid black;
background-color: #ff2742;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment