Ajout du bouton "reset" pour les choix de gemmes

master
adplantade 5 years ago
parent b3aca14c61
commit e88ab47283

@ -13,7 +13,7 @@
<form action="highscores.php" method="post">
<div class="mode-container">
<ul id="diff" class="all-container">
<ul id="diff" class="all-container bd">
<input type="radio" class="rad" name="difficulty" id="easy" value="easy" />
<label for="easy"><img id="img_easy" class="button" src="./ress/button_diff_easy.png"/></label>
@ -24,15 +24,15 @@
<label for="hard"><img id="img_hard" class="button" src="./ress/button_diff_hard.png"/></label>
</ul>
<div id="modeSelection">
<ul id="modes">
<div id="modeSelection" class="mode-container">
<ul id="modes" class="all-container bd">
<img id="img_points" class="button" src="./ress/button_mode_points.png"/>
<img id="img_temps" class="button" src="./ress/button_mode_temps.png"/>
<img id="img_survie" class="button" src="./ress/button_mode_survie.png"/>
</ul>
<ul id="points" class="all-container">
<ul id="points" class="all-container ad">
<input type="radio" class="rad" name="game_mode" id="5p" value="5p" />
<label for="5p"><img id="img_5p" class="button" src="./ress/button_points_5.png"/></label>
@ -46,7 +46,7 @@
<label for="20p"><img id="img_20p" class="button" src="./ress/button_points_20.png"/></label>
</ul>
<ul id="temps" class="all-container">
<ul id="temps" class="all-container ad">
<input type="radio" class="rad" name="game_mode" id="5m" value="5m" />
<label for="5m"><img id="img_5m" class="button" src="./ress/button_temps_5.png"/></label>
@ -54,7 +54,7 @@
<label for="10m"><img id="img_10m" class="button" src="./ress/button_temps_10.png"/></label>
</ul>
<ul id="survie" class="all-container">
<ul id="survie" class="all-container ad">
<input type="radio" class="rad" name="game_mode" id="15s" value="15s"/>
<label for="15s"><img id="img_15s" class="button" src="./ress/button_survie_15.png"/></label>
@ -78,7 +78,7 @@
<div class="slot">
<p>Changer le nombre de points</p>
<img src="ress/-" onClick="less()" id="-"/>
<span id="dotsNumber"></span>
<span id="dotsNumber" class="texte"></span>
<img src="ress/+" onClick="more()" id="+"/>
<input type="hidden" name="dotsAmount" id="amountHi"/>
</div>
@ -109,11 +109,11 @@
{
if(stristr($_POST['game_mode'], "p") === FALSE)
{
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select min(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select max(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
}
else
{
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select max(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select min(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
}
$result = $database->query($sql);
$a=$result->fetchArray();

@ -149,3 +149,9 @@
display: inline-block;
border: 1px solid white;
}
.texte {
font-size: xx-large;
font-weight: bold;
font-family: 'Segoe print';
}

@ -65,7 +65,7 @@
<div class="slidecontainer">
<p>Changer le nombre de points</p>
<img src="ress/-" onClick="less()" id="-"/>
<span id="dotsNumber"></span>
<span id="dotsNumber" class="texte"></span>
<img src="ress/+" onClick="more()" id="+"/>
<p>
Mode d'affichage :
@ -114,6 +114,7 @@
<div id="slot6" class="slot" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="slot7" class="slot" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="slot8" class="slot" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<img id="resetGems2" onClick="resetGems()" src="ress/reset"/>
</div>
</div>
<div>

@ -178,13 +178,15 @@ var gemsSelected=[];
for(var cpt=0;cpt<8;cpt++)
{
gemsSelected[cpt]= (getCookie("gem"+(cpt+1))=="" ? gemsAvailable[cpt] : getCookie("gem"+(cpt+1)));
console.log(gemsSelected[cpt]);
}
for(var cpt=1;cpt<9;cpt++)
{
eval("var gemIcon_"+gemsAvailable[cpt-1]+"=document.getElementById('gem"+cpt+"')");
eval('gemIcon_'+gemsAvailable[cpt-1]+'.src="ress/'+gemsAvailable[cpt-1]+'"');
eval('gemIcon_'+gemsAvailable[cpt-1]+'.width=size/6');
console.log("disp : "+gemsSelected[cpt-1]);
eval("var gemIcon_"+gemsSelected[cpt-1]+"=document.getElementById('gem"+cpt+"')");
eval('gemIcon_'+gemsSelected[cpt-1]+'.src="ress/'+gemsSelected[cpt-1]+'"');
eval('gemIcon_'+gemsSelected[cpt-1]+'.width=size/6');
eval("var slot"+cpt+"=document.getElementById('slot"+cpt+"')");
eval("slot"+cpt+".style.width=size/6");
@ -192,3 +194,15 @@ for(var cpt=1;cpt<9;cpt++)
document.getElementById("slot"+cpt).appendChild(eval("gem"+cpt));
}
//document.getElementById("resetGems").width=size/2;
document.getElementById("resetGems2").width=size/4;
function resetGems()
{
for(var cpt=1;cpt<9;cpt++)
{
setCookie("gem"+cpt,"",30);
document.getElementById("slot"+cpt).appendChild(eval("gemIcon_"+gemsAvailable[cpt-1]));
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 B

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

@ -17,11 +17,11 @@ Votre score est : <h1 id="points"></h1>
$database = new SQLite3("data.db");
if(stristr($_GET['mode'], "p") === FALSE)
{
$sql='select score, player from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and score=(select min(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].')';
$sql='select score, player from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and score=(select max(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].')';
}
else
{
$sql='select score, player from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and score=(select max(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].')';
$sql='select score, player from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and score=(select min(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].')';
}
$result = $database->query($sql);
@ -46,11 +46,11 @@ if($_GET['pseudo']!="")
{
if(stristr($_GET['mode'], "p") === FALSE) // vérification du mode pour afficher le score le plus grand ou le plus petit (- de temps = + de score)
{ //il n'y a pas "p" dans le mode, donc on cherche le plus haut score
$sqlScore='select min(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and player="'.$_GET['pseudo'].'"';
$sqlScore='select max(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and player="'.$_GET['pseudo'].'"';
}
else
{ // on est en points, donc on cherche le temps le plus faible
$sqlScore='select max(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and player="'.$_GET['pseudo'].'"';
$sqlScore='select min(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and player="'.$_GET['pseudo'].'"';
}
$result = $database->query($sqlScore); // on prend le meilleur score du joueur
$data = $result->fetchArray()[0];

@ -22,6 +22,11 @@ function applyLight(li) {
document.getElementById("modal").classList.remove((li=="true" ? "night" : "day"));
}
if(document.getElementById("resetGems")!=null)
{
document.getElementById("resetGems").src="ress/reset_"+(li=="true" ? "light" : "dark")+".png";
}
document.getElementsByTagName("body")[0].classList.add((li=="true" ? "day" : "night"));
document.getElementsByTagName("body")[0].classList.remove((li=="true" ? "night" : "day"));
}

Loading…
Cancel
Save