From 112539d345a8397a0da8d88f731e2e4076c0c633 Mon Sep 17 00:00:00 2001 From: pisouvigne Date: Mon, 20 Jul 2020 19:09:08 +0200 Subject: [PATCH] gen --- site/vue/css/style.css | 18 ++++++++++++ site/vue/database/insert.php | 13 ++------- site/vue/index.html | 53 ++++++++++++------------------------ site/vue/js/const.js | 5 +++- site/vue/js/db.js | 20 ++++++++------ site/vue/js/func.js | 12 ++++++-- site/vue/js/generateGame.js | 34 +++++++++++++++-------- 7 files changed, 85 insertions(+), 70 deletions(-) diff --git a/site/vue/css/style.css b/site/vue/css/style.css index 88e4a67..4ace028 100644 --- a/site/vue/css/style.css +++ b/site/vue/css/style.css @@ -606,6 +606,24 @@ input[type=color] { color: orange; } +#choice_button_div { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.choice { + margin: 10px auto; +} + +.retry_tuto { + display: none; +} + +#margin-left-10 { + margin-left: 25px; +} + .fa-info-circle:hover { cursor: help; } diff --git a/site/vue/database/insert.php b/site/vue/database/insert.php index 735ad79..03307b3 100644 --- a/site/vue/database/insert.php +++ b/site/vue/database/insert.php @@ -1,6 +1,6 @@ connect_error) { +if ($mysqli->connect_error) { exit('Could not connect'); } @@ -13,13 +13,4 @@ $stmt->bind_result($pseudo, $score, $id); $stmt->fetch(); $stmt->close(); -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo "
CustomerID" . $pseudo . "CompanyName" . $score . "ContactName" . $id . "
"; -?> \ No newline at end of file +echo ""; diff --git a/site/vue/index.html b/site/vue/index.html index aeb06bf..283831a 100644 --- a/site/vue/index.html +++ b/site/vue/index.html @@ -31,12 +31,8 @@ Normal -
- Personnalisé - -
- Test Nouveau Générateur + Mode Perso
@@ -111,34 +107,7 @@
- -
-
- -

Mode Perso

- -
-
-
-
-
- - -

-
- - -

-
- -

-
- -
-
+
@@ -151,11 +120,20 @@

click(s)


-
+ + +
+

Toujours afficher ce panneau

@@ -637,7 +615,10 @@ diff --git a/site/vue/js/const.js b/site/vue/js/const.js index b1fa4d2..c0ba463 100644 --- a/site/vue/js/const.js +++ b/site/vue/js/const.js @@ -46,6 +46,7 @@ var liveColonneNumber = []; var niveauActuel = 1; var isTuto = true; +var isTutoriel = false; //window @@ -64,4 +65,6 @@ var successPanel = true; var arrayPorte = []; -const NOMBRETEST = 500; \ No newline at end of file +const NOMBRETEST = 500; + +var tempCol = [], tempMatchs = [], tempFork = [], tempPortes = []; \ No newline at end of file diff --git a/site/vue/js/db.js b/site/vue/js/db.js index 7acbddc..e8072c2 100644 --- a/site/vue/js/db.js +++ b/site/vue/js/db.js @@ -1,11 +1,13 @@ function getTest() { - var xhttp; - xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { + console.log("oui"); + var xhttp; + xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function () { + if (this.readyState == 4 && this.status == 200) { document.getElementById("txtHint").innerHTML = this.responseText; - } - }; - xhttp.open("GET", "../database/insert.php", true); - xhttp.send(); - } \ No newline at end of file + } + }; + xhttp.open("GET", "../database/insert.php", true); + xhttp.send(); +} + diff --git a/site/vue/js/func.js b/site/vue/js/func.js index 9a09150..2707dd8 100644 --- a/site/vue/js/func.js +++ b/site/vue/js/func.js @@ -581,7 +581,6 @@ function checkEnd(mode) { endLines.forEach(function (element) { if (stage.findOne("#line" + element).stroke() == colorLineInnactive) { ter = false; - } }); if (ter && !isTuto) { @@ -602,6 +601,15 @@ function success(mode) { timer.stop(); stage.findOne("#end").fill("yellow"); layer.draw(); + if (mode != undefined && mode != null && mode === "tuto") { + document.querySelector(".retry_tuto").style.display = "flex"; + document.querySelector("#retry_tuto_button").onclick = function () { + closeModal('success'); + launchTuto(); + } + } else { + document.querySelector(".retry_tuto").style.display = "none"; + } if (successPanel) { openModal("success"); document.querySelector("#click_number").innerHTML = click; @@ -638,7 +646,7 @@ function nextLevel(mode) { if (mode != undefined && mode != null && mode === "tuto") { launchTuto(); } else { - launchGameOne(); + generate2(tempCol, tempMatchs, tempFork, tempPortes); } } diff --git a/site/vue/js/generateGame.js b/site/vue/js/generateGame.js index 4152fd8..3ebcb4a 100644 --- a/site/vue/js/generateGame.js +++ b/site/vue/js/generateGame.js @@ -232,6 +232,7 @@ function addGenForkInput() { function tuto(niveau) { setMode("Tuto"); + isTutoriel = true; windowWidth = window.innerWidth; windowHeight = window.innerHeight; var numberColonne1 = 2; @@ -322,7 +323,7 @@ function createGameOne(niveau) { numberColonne2 = 1; timeEnd = 20; break; - //Fin premiere serie + //Fin premiere serie case 5: firstTime.push("inv"); isNotAllowed = true; @@ -441,18 +442,23 @@ function createGameOne(niveau) { } -function generate2(col, matchs, fork) { +function generate2(col, matchs, fork, portes) { + isTutoriel = false; + isTuto = false; hideDiv(document.querySelector('#TestNouveauGenerateur')); showDiv(document.querySelector('#playPage')); resetAllTabs(false); + if (portes === null || portes === undefined) + arrayPorte = [ + [document.querySelector("#logique1").checked, "et"], + [document.querySelector("#logique2").checked, "ou"], + [document.querySelector("#logique3").checked, "inv"], + [document.querySelector("#logique4").checked, "etnon"], + [document.querySelector("#logique5").checked, "nonou"] + ]; + else arrayPorte = portes; + - arrayPorte = [ - [document.querySelector("#logique1").checked, "et"], - [document.querySelector("#logique2").checked, "ou"], - [document.querySelector("#logique3").checked, "inv"], - [document.querySelector("#logique4").checked, "etnon"], - [document.querySelector("#logique5").checked, "nonou"] - ]; arrayPorte = arrayPorte.filter(function (e) { if (e[0] === true) return e; @@ -461,10 +467,18 @@ function generate2(col, matchs, fork) { var numberCol = col.length; var numberPerCol = []; numberPerColonne = []; + tempMatchs = []; + tempFork = []; for (let i = 0; i < col.length; i++) { numberPerCol[i] = col[i]; numberPerColonne[i] = col[i]; } + for (let i = 0; i < matchs.length; i++) + tempMatchs[i] = matchs[i]; + for (let i = 0; i < fork.length; i++) + tempFork[i] = fork[i]; + tempPortes = portes; + tempCol = numberPerColonne; colonneTot = col.length; var compt = new Array(); @@ -529,7 +543,6 @@ function generate2(col, matchs, fork) { if (listeLogiqueObj[x].matchId1 !== null) { if (getElementArray(listeLogiqueObj[x].matchId1, listeSame)[1] === null) { getElementArray(listeLogiqueObj[x].matchId1, listeSame)[1] = arrayPorte[num2][1]; - console.log(listeLogiqueObj[x].matchId2); if (listeLogiqueObj[x].matchId2 !== null && getElementArray(listeLogiqueObj[x].matchId2, listeSame)[1] === null) { getElementArray(listeLogiqueObj[x].matchId2, listeSame)[1] = arrayPorte[num2][1]; } @@ -539,7 +552,6 @@ function generate2(col, matchs, fork) { } } } - console.log(listeSame); createStage("play_container"); stage.add(layer);