pisouvigne 5 years ago
parent b938e76d76
commit e301fbd3f0

@ -231,6 +231,34 @@ html {
list-style: none;
}
.alert {
display: none;
position: absolute;
bottom: 0;
right: 0;
left: 0;
margin: 0 20% 2% 20%;
padding: 20px;
background-color: var(--cool-color);
color: white;
}
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
.closebtn:hover {
color: black;
}
.fa-cog {
font-size: 5vh;
position: absolute;
@ -273,8 +301,8 @@ html {
.fa-info {
font-size: 5vh;
position: absolute;
right: 0;
top: 0;
left: 0;
bottom: 0;
margin: 4vh;
transition: .5s;
}
@ -510,6 +538,8 @@ hr {
.header_play {
display: flex;
height: 100%;
margin-top: -1em;
align-items: center;
padding: 0 50px 0 50px;
justify-content: space-between;
@ -723,6 +753,7 @@ input[type=color] {
}
.progress_bar {
display: none;
height: 10px;
margin: 20px;
animation: progressbar-countdown;
@ -738,6 +769,7 @@ input[type=color] {
}
#win_pannel {
height: 15em;
display: none;
}
@ -769,3 +801,32 @@ input[type=color] {
#pseudoInput {
height: 2em;
}
#play_menu_game {
height: 15em;
}
.flexbox_inline {
padding: 0 25px 0 25px;
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: row;
}
#retry_tuto_button {
margin-right: 10px;
}
#lose_pannel {
display: none;
height: 15em;
}
#fa-home-2 {
margin-left: 25px;
}
#LastSelectionPage {
display: none;
}

Binary file not shown.

@ -41,6 +41,76 @@
</div>
</div>
</div>
<!--Last Selection-->
<div id="LastSelectionPage" class="background">
<div id="header_selection" align=center>
<i class="fa fa-arrow-left home" onclick="closeSelection();" aria-hidden="true"></i>
<h1 class="dys" id="title_selection_last"><a id="testTitlSelect"></a></h1>
<label></label>
</div>
<hr id="hr">
<div id="selectionContainer">
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement chap1"
onclick="wait('vanillaImpossible', this)">
<a>Chapitre 1</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover vanillaElement scoreElement chap1Score"
onclick="leaderboard('vanillaImpossible', this)">
<a></a>
<i class="fa fa-trophy" aria-hidden="true"></i>
</div>
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement chap2" onclick="">
<a>Chapitre 2</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover vanillaElement scoreElement chap2Score"
onclick="leaderboard('vanillaImpossible', this)">
<a></a>
<i class="fa fa-trophy" aria-hidden="true"></i>
</div>
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement chap3"
onclick="wait('vanillaImpossible', this)">
<a>Chapitre 3</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover vanillaElement scoreElement chap3Score"
onclick="leaderboard('vanillaImpossible', this)">
<a></a>
<i class="fa fa-trophy" aria-hidden="true"></i>
</div>
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement chap4"
onclick="wait('vanillaImpossible', this)">
<a>Chapitre 4</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover vanillaElement scoreElement chap4Score"
onclick="leaderboard('vanillaImpossible', this)">
<a></a>
<i class="fa fa-trophy" aria-hidden="true"></i>
</div>
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement chap5"
onclick="wait('vanillaImpossible', this)">
<a>Chapitre 5</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover vanillaElement scoreElement chap5Score"
onclick="leaderboard('vanillaImpossible', this)">
<a></a>
<i class="fa fa-trophy" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
<!-- Vanilla Selection -->
<div id="scoreModal" class="modal">
<div class="modal-content score-content">
@ -64,40 +134,24 @@
<label></label>
</div>
<hr id=" hr">
<div id="selectionVanillaContainer">
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement" onclick="wait('vanillaFacile', this)">
<div class="border background dys listenerHover sel1" onclick="wait('vanillaFacile', this)">
<a>Facile</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover vanillaElement scoreElement"
onclick="leaderboard('vanillaFacile', this)">
<a></a>
<i class="fa fa-trophy" aria-hidden="true"></i>
<i class="fa fa-arrow-right" id="right_select" aria-hidden="true"></i>
</div>
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement" onclick="wait('vanillaMoyen', this)">
<div class="border background dys listenerHover sel2" onclick="wait('vanillaMoyen', this)">
<a>Moyen</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover vanillaElement scoreElement"
onclick="leaderboard('vanillaMoyen', this)">
<a></a>
<i class="fa fa-trophy" aria-hidden="true"></i>
<i class="fa fa-arrow-right" id="right_select" aria-hidden="true"></i>
</div>
</div>
<div id="containerVanilla">
<div class="border background dys listenerHover vanillaElement"
onclick="wait('vanillaImpossible', this)">
<div class="border background dys listenerHover sel3" onclick="wait('vanillaImpossible', this)">
<a>Impossible</a>
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover vanillaElement scoreElement"
onclick="leaderboard('vanillaImpossible', this)">
<a></a>
<i class="fa fa-trophy" aria-hidden="true"></i>
<i class="fa fa-arrow-right" id="right_select" aria-hidden="true"></i>
</div>
</div>
<div id="containerVanilla">
@ -474,26 +528,50 @@
</div>
<div id="progress_bar" class="progress_bar border backgroundInv"></div>
</div>
<br>
<div id="win_pannel" class="border background" align=center>
<h1 class="txt dys" id="successTitle"></h1>
<div id="lose_pannel" class="border" align=center>
<h2 class="txt dys" id="gameOverTitle"></h2>
<hr id="hr">
<p class="dys"><a class="txt" id="successInfo"></a><a id="click_number"></a><a> click(s)</a>
</p>
<div id="choice_button_div">
<div class="border background dys listenerHover choice retry_tuto" id="retry_tuto_button"
onclick="closeModal('success');retry();"">
<a>Refaire le niveau</a>
<i class=" fa fa-retweet" id="margin-left-10" aria-hidden="true"></i>
<div class="flexbox_inline">
<div class="border background dys listenerHover" id="backHomeBtn" onclick="backHome()">
<a id="niveauSuivantText">Retour au menu</a>
<i class="fa fa-home" id="fa-home-2" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover choice" id="next_level_button"
onclick="closeModal('success');nextLevel();">
<a id="niveauSuivantText">Niveau suivant</a>
<i class="fa fa-arrow-right" id="right_select" aria-hidden="true"></i>
<div>
<p><a class="dys"></a><a class="dys" id="scoreTotGameOver"></a></p>
<p class="dys"><a class="dys"></a><a class="dys" id="TempsTotGameOver"></a></p>
<p><a class="dys">Vous avez atteint le niveau : </a><a class="dys" id="niveauGameOver"></a><a
class="dys"> / 5</a></p>
</div>
<div class="border background dys listenerHover" id="retry_button" onclick="">
<a>Réessayer</a>
<i class=" fa fa-retweet" id="margin-left-10" aria-hidden="true"></i>
</div>
</div>
</div>
<div id="win_pannel" class="border" align=center>
<h2 class="txt dys" id="successTitle"></h2>
<hr id="hr">
<div class="flexbox_inline">
<p class="dys"><a class="txt" id="successInfo"></a><a id="click_number"></a><a> click(s)</a>
</p>
<div id="choice_button_div">
<div class="border background dys listenerHover choice retry_tuto" id="retry_tuto_button"
onclick="closeModal('success');retry();"">
<a>Refaire le niveau</a>
<i class=" fa fa-retweet" id="margin-left-10" aria-hidden="true"></i>
</div>
<div class="border background dys listenerHover choice" id="next_level_button"
onclick="closeModal('success');nextLevel();">
<a id="niveauSuivantText">Niveau suivant</a>
<i class="fa fa-arrow-right" id="right_select" aria-hidden="true"></i>
</div>
</div>
<p class="dys"><a class="txt" id="timeInfo"></a><a id="time_number"></a><a> seconde(s)</a>
</div>
</div>
<br>
<div id="play_container" class="border">
@ -507,11 +585,14 @@
<div class="btn_play" id="menu-selection">
<a onclick="play();"><i class="far fa-play-circle"></i></a>
</div>
<a onclick="openModal('myModal')"><i class="fa fa-cog" id="setting" aria-hidden="true"></i></a>
<a onclick="openModal('scoreModal')"><i class="fa fa-trophy trophyMain" id="setting" aria-hidden="true"></i></a>
<a onclick="document.location.href='https://gitlab.iut-clermont.uca.fr/'; "><i class="fa fa-users" id="setting"
aria-hidden="true"></i></a>
<a onclick="openModal('infoModal')"><i class="fa fa-info" id="setting" aria-hidden="true"></i></a>
<div class="alert dys">
<span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span>
<strong>Bienvenue!</strong> C'est la première fois que vous vous connectez, vous pouvez changer votre pseudo
et les configurations du jeu dans les paramètres !
</div>
<div id="myModal" class="modal">
<div class="modal-content">
@ -622,89 +703,10 @@
<div class="modal-content info-content">
<div class="modal-body border background" align=center>
<span class="close" onclick="closeModal('infoModal')">&times;</span>
<h1 class="txt dys" id="infoTitle">Tableau des scores</h1>
<h1 class="txt dys" id="infoTitle"></h1>
<hr id="hr">
<p class="dys">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et malesuada
lectus.
Morbi
imperdiet fringilla maximus. Integer ac aliquet ex. Quisque vestibulum elit ac velit
feugiat
facilisis. Nam in pharetra nisl, sed dignissim nibh. Donec ultricies sem quis turpis
eleifend
porta.
Sed in risus hendrerit, tincidunt ante id, cursus tellus. Mauris et nisl neque. Fusce id
dictum
sapien.
Vivamus ornare porta egestas. Cras id sem et turpis imperdiet mollis nec in turpis. Cras
semper
urna
sit amet neque pharetra vulputate. Vestibulum ante ipsum primis in faucibus orci luctus
et
ultrices
posuere cubilia curae; In congue lorem at tellus ornare malesuada. Sed vel volutpat
tortor.
Aenean
imperdiet hendrerit arcu, vel faucibus mauris porttitor quis.
Suspendisse potenti. Suspendisse tincidunt arcu nec nisi vulputate, a tempus est
sagittis. Donec
laoreet pulvinar sem, eu condimentum turpis feugiat quis. Morbi varius erat a iaculis
lacinia.
Sed
sed nibh iaculis, pulvinar risus sed, fermentum justo. Aenean id libero maximus risus
ornare
elementum. Aenean nec ex porta, efficitur quam sed, dignissim arcu. Vivamus pharetra
sapien a
augue
aliquam consectetur. Morbi dictum lobortis elit, a faucibus ligula ultricies ac. Nullam
suscipit
at
risus ut fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis luctus
ex nec
finibus semper. Pellentesque quam magna, gravida sed semper bibendum, gravida nec augue.
Interdum et
malesuada fames ac ante ipsum primis in faucibus. Nulla imperdiet ex ut sapien facilisis
auctor.
Vivamus vestibulum fermentum odio vel viverra. Donec nec nisi ex. Curabitur tempor
venenatis
porttitor. Ut eget vehicula turpis. Curabitur vel pellentesque dui, a rhoncus purus.
Maecenas et
leo
ultricies, sodales sapien ac, venenatis risus. Vestibulum elementum, felis ac malesuada
tincidunt,
sem arcu suscipit mi, quis malesuada mauris nibh in diam. Mauris erat diam, bibendum sed
viverra
vel, eleifend sed lorem. Morbi cursus tincidunt eros eu tincidunt. Aliquam eget viverra
leo.
Aenean
quis odio in elit dictum faucibus. Vivamus tristique, lectus at pretium lobortis, neque
odio
efficitur leo, aliquam rutrum nunc massa in diam. Sed mattis, tellus convallis ultricies
lobortis,
odio justo maximus nisi, at efficitur dui nulla at eros. Mauris eleifend felis non est
molestie
sollicitudin.
Vivamus neque felis, interdum eu egestas eget, imperdiet vel orci. Etiam finibus
venenatis
tortor,
vitae feugiat dolor malesuada eget. Nulla erat sem, venenatis ac tincidunt eget,
condimentum et
est.
Nam a pharetra ligula. Nullam quis convallis turpis. Duis quis nibh ut mi commodo
euismod. Ut
iaculis vestibulum elit vitae scelerisque. Sed sollicitudin, leo id cursus placerat,
erat ipsum
varius dolor, non egestas erat nibh sed nisl. Vestibulum sit amet purus sed nulla mattis
malesuada
eget vitae ligula. Vivamus iaculis, felis vel dapibus lacinia, nisl felis tincidunt sem,
vel
finibus
mauris elit maximus lorem. Donec non viverra leo. Vestibulum iaculis ipsum et mi aliquam
aliquam.
Vivamus maximus justo eu fermentum hendrerit.</p>
<p class="dys">Site développé par Pierre SOUVIGNET lors d'un projet de 2ème année de DUT
Informatique à Clermont-Ferrand. Supervisé par Mme Malika More et Mr Pascal Lafourcade</p>
</div>
</div>
@ -721,7 +723,6 @@
<script src="js/logique.js"></script>
<script src="js/init.js"></script>
<script src="js/main.js"></script>
<script src="js/creator.js"></script>
<script src="js/timer.js"></script>
<script src="js/db.js"></script>
<script src="js/generateGame.js"></script>

@ -35,6 +35,7 @@ var colorSwitchActiveBackground = "#2ec22e";
//timer
var timeEnd = 10;
var timeTot = 0;
var time;
//switch
var numberOfSwitch = 0;

@ -1,173 +0,0 @@
function createGame1() {
timeEnd = 20;
initTimer();
createSwitch("s1", 20, 20);
createSwitch("s2", 20, 90);
createSwitch("s3", 20, 300);
createSwitch("s4", 20, 500);
createSwitch("s5", 20, 700);
createSwitch("s6", 20, 600);
createSwitch("s7", 350, 600);
createLogique(200, 100, "logique1", "et");
createLogique(300, 200, "logique2", "nonou");
createLogique(500, 300, "logique3", "et");
createLogique(500, 400, "logique4", "etnon");
createLogique(500, 500, "logique5", "inv");
createLink(stage.findOne("#s7"), findLogique("logique5"));
createLink(stage.findOne("#s5"), findLogique("logique4"));
createLink(stage.findOne("#s6"), findLogique("logique4"));
createLink(stage.findOne("#s3"), findLogique("logique2"));
createLink(stage.findOne("#s2"), findLogique("logique1"));
createLink(stage.findOne("#s1"), findLogique("logique1"));
createLink(findLogique("logique1"), findLogique("logique2"));
createLink(stage.findOne("#s4"), findLogique("logique3"));
createLink(findLogique("logique2"), findLogique("logique3"));
initAllSwitch();
createEnd(800, 320);
initEnd();
}
function createGame2() {
timeEnd = 40;
colonneTot = 3;
numberPerColonne = [1, 1, 3];
initTimer();
switchCreator(7);
insertLogiqueColonne("logique1", "et", 0);
insertLogiqueColonne("logique2", "nonou", 1);
insertLogiqueColonne("logique3", "et", 2);
insertLogiqueColonne("logique4", "etnon", 2);
insertLogiqueColonne("logique5", "inv", 2);
createLink(findLogique("logique1"), findLogique("logique2"));
createLink(findLogique("logique2"), findLogique("logique3"));
createAllLinkSwitch();
initAllSwitch();
createEnd();
initEnd();
}
function creatorRandomPyramid() {
timeEnd = getRandomArbitrary(15, 50);
initTimer();
var premiereColonne = 2;
let still = premiereColonne;
let nmbColonne = 1;
while (still != 1) {
still = still / 2;
nmbColonne++;
}
var logiqueCount = 0;
colonneTot = nmbColonne;
for (let i = 0; i < colonneTot; i++) {
liveColonneNumber.push([]);
}
premiereColonne = premiereColonne * 2;
for (let i = 0; i < colonneTot; i++) {
numberPerColonne[i] = premiereColonne - premiereColonne / 2;
premiereColonne = premiereColonne / 2;
for (let j = 0; j < numberPerColonne[i]; j++) {
logiqueCount++;
let type = null;
switch (getRandomArbitrary(0, 4)) {
case 0:
type = "et";
break;
case 1:
type = "ou";
break;
case 2:
type = "etnon";
break;
case 3:
type = "nonou";
break;
}
insertLogiqueColonne("logique" + logiqueCount, type, i);
}
}
logiques.forEach(function (element) {
createLinkAuto(element.name);
});
calculNombreSwitch();
switchCreator(numberOfSwitch);
createAllLinkSwitch();
initAllSwitch();
createEnd();
initEnd();
}
function generatorGame() {
timeEnd = getRandomArbitrary(15, 50);
initTimer();
var logiqueCount = 0;
colonneTot = getRandomArbitrary(2, 3);
for (let i = 0; i < colonneTot; i++) {
liveColonneNumber.push([]);
}
for (let i = 0; i < colonneTot; i++) {
numberPerColonne[i] = getRandomArbitrary(2, 4);
for (let j = 0; j < numberPerColonne[i]; j++) {
logiqueCount++;
let type = null;
switch (getRandomArbitrary(0, 4)) {
case 0:
type = "et";
break;
case 1:
type = "ou";
break;
case 2:
type = "etnon";
break;
case 3:
type = "nonou";
break;
}
insertLogiqueColonne("logique" + logiqueCount, type, i);
}
}
logiques.forEach(function (element) {
createLinkAuto(element.name);
});
calculNombreSwitch();
switchCreator(numberOfSwitch);
createAllLinkSwitch();
initAllSwitch();
createEnd();
initEnd();
}

@ -8,7 +8,6 @@ function tryChangePseudo() {
}
function setPseudoOk(newPseudo, change) {
document.querySelector("#saveIco").className = "fa fa-save";
document.querySelector("#saveIco").style.color = "green";
if (change) {
changePseudo(newPseudo, pseudo);
@ -18,12 +17,10 @@ function setPseudoOk(newPseudo, change) {
}
}
function setPseudoNotOk() {
document.querySelector("#saveIco").className = "fa fa-save";
document.querySelector("#saveIco").style.color = "#fe8a71";
}
document.querySelector("#pseudoInput").addEventListener('input', (event) => {
document.querySelector("#saveIco").className = "fa fa-database dys";
isPseudoOk(document.querySelector("#pseudoInput").value, false);
});
@ -666,6 +663,7 @@ function checkEnd(mode) {
function success(mode) {
document.querySelector("#play_menu_game").style.display = "none";
modeG = mode;
time = timer.getTimeValues().seconds;
timeTot = timeTot + timer.getTimeValues().seconds;
timer.stop();
stage.findOne("#end").fill(colorSwitchActiveBackground);
@ -681,10 +679,8 @@ function success(mode) {
}
if (successPanel) {
if (isFinish) {
showDiv(document.querySelector("#mainPage"));
hideDiv(document.querySelector("#playPage"));
openModal("gameOver");
document.querySelector("#lose_pannel").style.display = "block";
document.querySelector("#play_menu_game").style.display = "none";
switch (mode) {
case "vanillaFacile":
document.querySelector("#gameOverTitle").innerHTML = 'Vanilla Facile';
@ -698,16 +694,17 @@ function success(mode) {
if (niveauActuel === 1)
scoreTot = 0;
else
scoreTot = ((1 / timeTot) * (1 / clickTot) * 1000).toFixed(2);
scoreTot = ((1 / timeTot) * (1 / clickTot) * 100000).toFixed(2);
document.querySelector("#scoreTotGameOver").innerHTML = "Score : " + scoreTot;
document.querySelector("#niveauGameOver").innerHTML = niveauActuel;
document.querySelector("#TempsTotGameOver").innerHTML = "Temps : " + timeTot;
document.querySelector("#TempsTotGameOver").innerHTML = "Temps : " + timeTot + " s";
sendScore(scoreTot, mode, clickTot, niveauActuel, 25, timeTot);
clickTot = 0;
} else {
document.querySelector("#win_pannel").style.display = "block";
//openModal("success");
document.querySelector("#click_number").innerHTML = click;
document.querySelector("#time_number").innerHTML = time;
document.querySelector("#next_level_button").onclick = function () {
//closeModal('success');
nextLevel(mode);
@ -750,6 +747,49 @@ function nextLevel(mode) {
launchMoyenGameOne(mode);
} else if (mode === "vanillaImpossible" || mode === "normalImpossible") {
launchImpossibleGameOne(mode);
} else if (mode === "vanillaFacile1" || mode === "normalFacile1") {
launchFacileChapitre1(mode);
}
else if (mode === "vanillaFacile2" || mode === "normalFacile2") {
launchFacileChapitre2(mode);
}
else if (mode === "vanillaFacile3" || mode === "normalFacile3") {
launchFacileChapitre3(mode);
}
else if (mode === "vanillaFacile4" || mode === "normalFacile4") {
launchFacileChapitre4(mode);
} else if (mode === "vanillaFacile5" || mode === "normalFacile5") {
launchFacileChapitre5(mode);
}
//Moyen
else if (mode === "vanillaMoyen1" || mode === "normalMoyen1") {
launchMoyenChapitre1(mode);
}
else if (mode === "vanillaMoyen2" || mode === "normalMoyen2") {
launchMoyenChapitre2(mode);
}
else if (mode === "vanillaMoyen3" || mode === "normalMoyen3") {
launchMoyenChapitre3(mode);
}
else if (mode === "vanillaMoyen4" || mode === "normalMoyen4") {
launchMoyenChapitre4(mode);
} else if (mode === "vanillaMoyen5" || mode === "normalMoyen5") {
launchMoyenChapitre5(mode);
}
//Impossible :
else if (mode === "vanillaImpossible1" || mode === "normalImpossible1") {
launchImpossibleChapitre1(mode);
}
else if (mode === "vanillaImpossible2" || mode === "normalImpossible2") {
launchImpossibleChapitre2(mode);
}
else if (mode === "vanillaImpossible3" || mode === "normalImpossible3") {
launchImpossibleChapitre3(mode);
}
else if (mode === "vanillaImpossible4" || mode === "normalImpossible4") {
launchImpossibleChapitre4(mode);
} else if (mode === "vanillaImpossible5" || mode === "normalImpossible5") {
launchImpossibleChapitre5(mode);
}
}
@ -917,7 +957,6 @@ function goToSelection(btn) {
}
function vanillaSelection() {
document.querySelector("#title_selection_2").innerHTML = "Vanilla";
document.querySelector("#selectionNormalContainer").style.display = "none";
document.querySelector("#selectionVanillaContainer").style.display = "flex";
hideDiv(document.querySelector("#levelSelectionPage"));
@ -926,18 +965,36 @@ function vanillaSelection() {
if (element.children[0].innerHTML !== "")
element.children[1].className = "fa fa-play";
});
document.querySelector(".sel1").onclick = function () {
wait('vanillaFacile', document.querySelector(".sel1"))
}
document.querySelector(".sel2").onclick = function () {
wait('vanillaMoyen', document.querySelector(".sel2"))
}
document.querySelector(".sel3").onclick = function () {
wait('vanillaImpossible', document.querySelector(".sel3"))
}
}
function normalSelection() {
document.querySelector("#title_selection_2").innerHTML = "Normal";
document.querySelector("#selectionVanillaContainer").style.display = "none";
document.querySelector("#selectionNormalContainer").style.display = "flex";
document.querySelector("#selectionNormalContainer").style.display = "none";
document.querySelector("#selectionVanillaContainer").style.display = "flex";
hideDiv(document.querySelector("#levelSelectionPage"));
showDiv(document.querySelector("#VanillalevelSelectionPage"));
document.querySelectorAll(".vanillaElement").forEach(function (element) {
if (element.children[0].innerHTML !== "")
element.children[1].className = "fa fa-play";
});
document.querySelector(".sel1").onclick = function () {
wait('normalFacile', document.querySelector(".sel1"))
}
document.querySelector(".sel2").onclick = function () {
wait('normalMoyen', document.querySelector(".sel2"))
}
document.querySelector(".sel3").onclick = function () {
wait('normalImpossible', document.querySelector(".sel3"))
}
}
function playVanilla() {
@ -949,48 +1006,85 @@ function playVanilla() {
}
function playFacileVanilla() {
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#LastSelectionPage"));
for (let i = 1; i < 6; i++) {
document.querySelector(".chap" + i).onclick = function () {
wait('vanillaFacile' + i, document.querySelector(".chap" + i))
}
document.querySelector(".chap" + i + "Score").onclick = function () {
leaderboard('vanillaFacile' + i, document.querySelector(".chap" + i + "Score"))
}
}
/*hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileGameOne("vanillaFacile");
launchFacileGameOne("vanillaFacile");*/
}
function playImpossibleVanilla() {
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchImpossibleGameOne("vanillaImpossible");
showDiv(document.querySelector("#LastSelectionPage"));
for (let i = 1; i < 6; i++) {
document.querySelector(".chap" + i).onclick = function () {
wait('vanillaImpossible' + i, document.querySelector(".chap" + i))
}
document.querySelector(".chap" + i + "Score").onclick = function () {
leaderboard('vanillaImpossible' + i, document.querySelector(".chap" + i + "Score"))
}
}
}
//Vanilla
function playMoyenVanilla() {
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchMoyenGameOne("vanillaMoyen");
showDiv(document.querySelector("#LastSelectionPage"));
for (let i = 1; i < 6; i++) {
document.querySelector(".chap" + i).onclick = function () {
wait('vanillaMoyen' + i, document.querySelector(".chap" + i))
}
document.querySelector(".chap" + i + "Score").onclick = function () {
leaderboard('vanillaMoyen' + i, document.querySelector(".chap" + i + "Score"))
}
}
}
//normal
function playFacileNormal() {
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileGameOne("normalFacile");
showDiv(document.querySelector("#LastSelectionPage"));
for (let i = 1; i < 6; i++) {
document.querySelector(".chap" + i).onclick = function () {
wait('normalFacile' + i, document.querySelector(".chap" + i))
}
document.querySelector(".chap" + i + "Score").onclick = function () {
leaderboard('normalFacile' + i, document.querySelector(".chap" + i + "Score"))
}
}
}
function playImpossibleNormal() {
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchImpossibleGameOne("normalImpossible");
showDiv(document.querySelector("#LastSelectionPage"));
for (let i = 1; i < 6; i++) {
document.querySelector(".chap" + i).onclick = function () {
wait('normalImpossible' + i, document.querySelector(".chap" + i))
}
document.querySelector(".chap" + i + "Score").onclick = function () {
leaderboard('normalImpossible' + i, document.querySelector(".chap" + i + "Score"))
}
}
}
function playMoyenNormal() {
hideDiv(document.querySelector("#VanillalevelSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchMoyenGameOne("normalMoyen");
showDiv(document.querySelector("#LastSelectionPage"));
for (let i = 1; i < 6; i++) {
document.querySelector(".chap" + i).onclick = function () {
wait('normalMoyen' + i, document.querySelector(".chap" + i))
}
document.querySelector(".chap" + i + "Score").onclick = function () {
leaderboard('normalMoyen' + i, document.querySelector(".chap" + i + "Score"))
}
}
}
function modeTuto() {
@ -1023,12 +1117,253 @@ function WarningMessage(message) {
document.querySelector(".fa-info-circle").style.display = "block";
}
}
//Facile
function playFacile1() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileChapitre1(modeG);
}
function playFacile2() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileChapitre2(modeG);
}
function playFacile3() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileChapitre3(modeG);
}
function playFacile4() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileChapitre4(modeG);
}
function playFacile5() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchFacileChapitre5(modeG);
}
//Moyen
function playMoyen1() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchMoyenChapitre1(modeG);
}
function playMoyen2() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchMoyenChapitre2(modeG);
}
function playMoyen3() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchMoyenChapitre3(modeG);
}
function playMoyen4() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchMoyenChapitre4(modeG);
}
function playMoyen5() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchMoyenChapitre5(modeG);
}
//Impossible
function playImpossible1() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchImpossibleChapitre1(modeG);
}
function playImpossible2() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchImpossibleChapitre2(modeG);
}
function playImpossible3() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchImpossibleChapitre3(modeG);
}
function playImpossible4() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchImpossibleChapitre4(modeG);
}
function playImpossible5() {
hideDiv(document.querySelector("#LastSelectionPage"));
showDiv(document.querySelector("#playPage"));
niveauActuel = 1;
timeTot = 0;
launchImpossibleChapitre5(modeG);
}
function wait(mode, btn) {
document.querySelector("#lose_pannel").style.display = "none";
isFinish = false;
var time = 300;
spin(btn);
modeG = mode;
switch (mode) {
//Normal
case "normalFacile1":
setTimeout(playFacile1, time);
setMode("Normal Facile - Chapitre 1");
break;
case "normalFacile2":
setTimeout(playFacile2, time);
setMode("Normal Facile - Chapitre 2");
break;
case "normalFacile3":
setTimeout(playFacile3, time);
setMode("Normal Facile - Chapitre 3");
break;
case "normalFacile4":
setTimeout(playFacile4, time);
setMode("Normal Facile - Chapitre 4");
break;
case "normalFacile5":
setTimeout(playFacile5, time);
setMode("Normal Facile - Chapitre 5");
break;
//normal Moyen
case "normalMoyen1":
setTimeout(playMoyen1, time);
setMode("Normal Moyen - Chapitre 1");
break;
case "normalMoyen2":
setTimeout(playMoyen2, time);
setMode("Normal Moyen - Chapitre 2");
break;
case "normalMoyen3":
setTimeout(playMoyen3, time);
setMode("Normal Moyen - Chapitre 3");
break;
case "vanillaMoyen4":
setTimeout(playMoyen4, time);
setMode("Vanilla Moyen - Chapitre 4");
break;
case "normalMoyen5":
setTimeout(playMoyen5, time);
setMode("Normal Moyen - Chapitre 5");
break;
//Impossible
case "normalImpossible1":
setTimeout(playImpossible1, time);
setMode("Normal Impossible - Chapitre 1");
break;
case "normalImpossible2":
setTimeout(playImpossible2, time);
setMode("Normal Impossible - Chapitre 2");
break;
case "normalImpossible3":
setTimeout(playImpossible3, time);
setMode("Normal Impossible - Chapitre 3");
break;
case "normalImpossible4":
setTimeout(playImpossible4, time);
setMode("Normal Impossible - Chapitre 4");
break;
case "normalImpossible5":
setTimeout(playImpossible5, time);
setMode("Normal Impossible - Chapitre 5");
break;
//Vanilla
//Vanilla Facile
case "vanillaFacile1":
setTimeout(playFacile1, time);
setMode("Vanilla Facile - Chapitre 1");
break;
case "vanillaFacile2":
setTimeout(playFacile2, time);
setMode("Vanilla Facile - Chapitre 2");
break;
case "vanillaFacile3":
setTimeout(playFacile3, time);
setMode("Vanilla Facile - Chapitre 3");
break;
case "vanillaFacile4":
setTimeout(playFacile4, time);
setMode("Vanilla Facile - Chapitre 4");
break;
case "vanillaFacile5":
setTimeout(playFacile5, time);
setMode("Vanilla Facile - Chapitre 5");
break;
//Vanilla Moyen
case "vanillaMoyen1":
setTimeout(playMoyen1, time);
setMode("Vanilla Moyen - Chapitre 1");
break;
case "vanillaMoyen2":
setTimeout(playMoyen2, time);
setMode("Vanilla Moyen - Chapitre 2");
break;
case "vanillaMoyen3":
setTimeout(playMoyen3, time);
setMode("Vanilla Moyen - Chapitre 3");
break;
case "vanillaMoyen4":
setTimeout(playMoyen4, time);
setMode("Vanilla Moyen - Chapitre 4");
break;
case "vanillaMoyen5":
setTimeout(playMoyen5, time);
setMode("Vanilla Moyen - Chapitre 5");
break;
//Impossible
case "vanillaImpossible1":
setTimeout(playImpossible1, time);
setMode("Vanilla Impossible - Chapitre 1");
break;
case "vanillaImpossible2":
setTimeout(playImpossible2, time);
setMode("Vanilla Impossible - Chapitre 2");
break;
case "vanillaImpossible3":
setTimeout(playImpossible3, time);
setMode("Vanilla Impossible - Chapitre 3");
break;
case "vanillaImpossible4":
setTimeout(playImpossible4, time);
setMode("Vanilla Impossible - Chapitre 4");
break;
case "vanillaImpossible5":
setTimeout(playImpossible5, time);
setMode("Vanilla Impossible - Chapitre 5");
break;
//Autre
case "vanillaInfini":
setTimeout(playVanilla, time);
setMode("Vanilla Infini");
@ -1036,36 +1371,44 @@ function wait(mode, btn) {
case "vanillaFacile":
setTimeout(playFacileVanilla, time);
setMode("Vanilla Facile");
setTitle("Vanilla Facile");
break;
case "vanillaImpossible":
setTimeout(playImpossibleVanilla, time);
setTitle("Vanilla Impossible");
setMode("Vanilla Impossible");
break;
case "vanillaMoyen":
setTimeout(playMoyenVanilla, time);
setTitle("Vanilla Moyen");
setMode("Vanilla Moyen");
break;
case "normalFacile":
setTimeout(playFacileNormal, time);
setTitle("Normal Facile");
setMode("Normal Facile");
break;
case "normalImpossible":
setTimeout(playImpossibleNormal, time);
setTitle("Normal Impossible");
setMode("Vanilla Impossible");
break;
case "normalMoyen":
setTimeout(playMoyenNormal, time);
setMode("Normal Moyen");
setTitle("Normal Moyen");
break;
case "normalInfini":
setTimeout(playNormal, time);
setMode("Normal Infini");
break;
case "normal":
document.querySelector("#title_selection_2").innerHTML = "Normal";
setTimeout(normalSelection, time);
setMode("Normal");
break;
case "vanilla":
document.querySelector("#title_selection_2").innerHTML = "Vanilla";
setTimeout(vanillaSelection, time);
setMode("Vanilla")
break;
@ -1541,6 +1884,11 @@ function setMode(mode) {
document.querySelector("#modeDeJeu").innerHTML = mode;
}
function setTitle(mode) {
console.log(mode)
document.querySelector("#testTitlSelect").innerHTML = mode;
}
function launchTest() {
document.querySelector(".niveau").innerHTML = niveauActuel;
timer.stop();
@ -1566,6 +1914,7 @@ function closeGame() {
function closeSelection() {
showDiv(document.querySelector("#mainPage"));
hideDiv(document.querySelector("#LastSelectionPage"));
hideDiv(document.querySelector("#levelSelectionPage"));
}

File diff suppressed because it is too large Load Diff

@ -14,7 +14,7 @@ const lang = {
active_switch_setting: "Couleur interrupteur actif",
inactive_switch_setting: "Couleur interrupteur inactif",
scoreTitle: "Tableau des scores",
infoTitle: "Comment jouer ?",
infoTitle: "Informations",
gameOverTitle: "Perdu",
inactive_end_setting: "Couleur objectif : ",
modeDeJeu: "Mode de jeu",
@ -24,7 +24,7 @@ const lang = {
infoFirstTimeEt: "Porte \"et\"",
infoFirstTimeEtInfo1: "L'opérateur ET renvoie VRAI seulement si ses deux entrées sont à 1.<br><br><br> Voici la table de vérité :",
infoFirstTimeOu: "Porte \"ou\"",
infoFirstTimeOuInfo1: "L'opérateur OU renvoie VRAI si au moins une entrés est à 1.<br><br><br> Voici la table de vérité :",
infoFirstTimeOuInfo1: "L'opérateur OU renvoie VRAI si au moins une entrée est à 1.<br><br><br> Voici la table de vérité :",
infoFirstTimeinv: "Porte \"non\"",
infoFirstTimeinvInfo1: "La sortie est l'inverse de l'entrée.<br><br><br> Voici la table de vérité :",
cache_reinit: "Réinitialiser toutes les données du navigateur",
@ -36,9 +36,10 @@ const lang = {
symbole: "Mode symboles",
timerSetting: "Activer la barre timer",
infoFirstTimenonou: "Porte \"non-ou\"",
infoFirstTimenonouInfo1: "L'opérateur non-ou renvoie VRAI si aucune des entrés est à 1.<br><br><br> Voici la table de vérité :",
infoFirstTimenonouInfo1: "L'opérateur non-ou renvoie VRAI si aucune des entrées est à 1.<br><br><br> Voici la table de vérité :",
infoFirstTimeetnon: "Porte \"non-et\"",
infoFirstTimeetnonInfo1: "L'opérateur non-et renvoie FAUX si les deux entrés sont à 1. Sinon il renvoie VRAI<br><br><br> Voici la table de vérité :",
timeInfo: "Vous avez réussi en ",
infoFirstTimeetnonInfo1: "L'opérateur non-et renvoie FAUX si les deux entrées sont à 1. Sinon il renvoie VRAI<br><br><br> Voici la table de vérité :",
},
en: {
@ -57,7 +58,7 @@ const lang = {
active_switch_setting: "Color inactive switch : ",
inactive_switch_setting: "Color inactive switchs : ",
scoreTitle: "Scoreboard",
infoTitle: "How to play ?",
infoTitle: "Informations",
inactive_end_setting: "End color : ",
modeDeJeu: "Gamemode",
niveau: "Level ",

@ -10,6 +10,7 @@ function loadData() {
pseudo = localStorage.getItem("pseudo");
colorLineInnactive = localStorage.getItem("colorLineInnactive");
if (pseudo === null || pseudo === undefined) {
document.querySelector(".alert").style.display = "block";
pseudo = generateName();
}
if (colorLineInnactive === null || colorLineInnactive === undefined) {
@ -36,6 +37,13 @@ function loadData() {
document.querySelector("#inactive_switch_setting").value = colorSwitchInnactiveBackground;
}
function backHome() {
closeGame();
document.querySelector("#lose_pannel").style.display = "none";
hideDiv(document.querySelector("#playPage"));
showDiv(document.querySelector("#mainPage"));
}
var mobile = false;
var switchs = [],
lineCount = [],
@ -88,9 +96,6 @@ width = (window.innerWidth - window.innerWidth / 100 * 10);
height = window.innerHeight / 1.5;
function resetAllTabs(save) {
logiques.forEach(function (logique) {
layer.findOne("#" + logique.name).destroy();
});
if (!save) {
timeEnd = 5;
}
@ -112,28 +117,6 @@ function resetAllTabs(save) {
stage.draw();
}
function gameOne() {
document.querySelector("#play_container").style.maxHeight = window.innerHeight / 1.5 + "px";
createGameOne(niveauActuel);
isLineCollapsing();
click = 0;
var i = 0;
while (checkIfEnd() || isLineCollapsing()) {
if (i === NOMBRETEST) {
break;
}
resetAllTabs(false);
createGameOne(niveauActuel);
isLineCollapsing();
i++;
}
//console.log(stage);
//gameData = new GameData(height,width,2,10,"mode1",false,"play_container");
//gameData.createGame();
//checkAllSortieLogique();
}
function initEndGame(mode) {

@ -45,30 +45,36 @@ timer.addEventListener('secondsUpdated', function (e) {
});
function endTime() {
console.log(modeG)
if (modeG === "vanilla" || modeG === "normal") {
closeGame();
clickTot = clickTot + click;
var scoreTot
if (niveauActuel === 1)
scoreTot = 0;
else
scoreTot = ((1 / timeTot) * (1 / clickTot) * 1000).toFixed(2);
scoreTot = ((1 / timeTot) * (1 / clickTot) * 100000).toFixed(2);
document.querySelector("#scoreTotGameOver").innerHTML = "Score : " + scoreTot;
document.querySelector("#niveauGameOver").innerHTML = niveauActuel;
document.querySelector("#TempsTotGameOver").innerHTML = "Temps : " + timeTot;
sendScore(scoreTot, modeG, clickTot, niveauActuel, 25, timeTot);
clickTot = 0;
openModal('gameOver');
document.querySelector("#lose_pannel").style.display = "block";
document.querySelector("#play_menu_game").style.display = "none";
} else {
if (!isTuto) {
closeGame();
document.querySelector("#scoreTotGameOver").innerHTML = "Vous devez réussir tout les niveaux pour être classé";
document.querySelector("#niveauGameOver").innerHTML = "";
document.querySelector("#TempsTotGameOver").innerHTML = "";
openModal('gameOver');
document.querySelector("#lose_pannel").style.display = "block";
document.querySelector("#play_menu_game").style.display = "none";
document.querySelector("#niveauGameOver").innerHTML = niveauActuel;
}
}
isTuto = true;
document.querySelector("#retry_button").onclick = function () {
wait(modeG, document.querySelector(".listenerHover"));
document.querySelector("#lose_pannel").style.display = "none";
document.querySelector("#play_menu_game").style.display = "block";
}
}

Loading…
Cancel
Save