amélioration de la page de scores

affiche les records
la phrase de score est plus propre (affiche "secondes" ou "points" et s'adapte au score)
master
adplantade 5 years ago
parent 84b48d0900
commit bb9de482a4

@ -28,4 +28,4 @@ else if(get['mode'].includes('s'))
modeString = "Survie, +" + get['mode'];
}
mode.innerHTML += modeString + ", " + (get["diff"]=="easy" ? "facile" : (get["diff"]=="med" ? "moyen" : "difficile")) + "\n" + (getCookie("pause")==0 ? "pas de pause" : "pause");
mode.innerHTML += modeString + ", " + (get["diff"]=="easy" ? "facile" : (get["diff"]=="med" ? "moyen" : "difficile")) + "\n" + (getCookie("pause")==0 ? "pas de pause" : "avec pause");

@ -7,24 +7,25 @@
<div class="logo">
<img src="ress/logo_dark.png" id="logo"/>
<img src="ress/light" id="light" class="lightButton" onClick="switchLight()"/>
<span class="player texteG" id="player"></span>
</div>
<script src="selecteur.js"></script>
<p class="texteG" id="mode">Mode de jeu : </p>
<p class="texteG" id="points"> Votre score est </p>
<p class="texteG" id="points"></p>
</br>
<?php
$database = new SQLite3("data.db");
$toDisp=5;
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 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"].' order by score desc limit '.$toDisp;
$unit="points";
}
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 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"].' order by score asc limit '.$toDisp;
$unit="secondes";
}
$result = $database->query($sql);
@ -36,11 +37,15 @@ if($a==false)
}
else
{
$phrase="<p class='texteG'>Le record est ".$a[0].", tenu par ".$a["player"]."</p>";
$phrase="1° place : ".$a["player"].", ".$a[0]." ".$unit;
$cpt=2;
while ($row = $result->fetchArray()) {
$phrase=$phrase.", ".$row["player"];
$phrase=$phrase."</br>".$cpt."° place : ".$row["player"].", ".$row["score"]." ".$unit;
$cpt++;
}
echo $phrase;
echo "<h1 id='aya' class='texte' >".$phrase."</h1>";
}
?>
</br>
@ -89,18 +94,18 @@ if($_GET['pseudo']!="")
}
}
?>
<img id="btn_index" src="ress/button_index.png" onClick="index()"/>
<div class="mode-container">
<a href="./" rel="external"><img id="btn_index" src="ress/button_index.png" class="back" /></a>
</div>
<script>
size=screen.height/6;
document.getElementById("points").innerHTML += get['pts'] + " et votre record est "+ document.getElementById("rec").value;
phrase=get['pseudo']+", votre "+(get['mode'].includes('p') ? "temps" : "score") +" est "+ get['pts'] +" "+(get['mode'].includes('p') ? "secondes" : "points");
phrase+= (document.getElementById("rec").value==get['pts'] ? " et c'est votre record" : " et votre record est "+ document.getElementById("rec").value +" "+(get['mode'].includes('p') ? "secondes" : "points"));
document.getElementById("points").innerHTML = phrase;
document.getElementById("btn_index").width=size;
//docuemnt.getElementById("recap").innerHTML =
function index()
{
window.location.replace("./");
}
</script>
<script src="bakery.js"></script>

@ -15,11 +15,11 @@ function $_GET(param) {
var get=$_GET();
//if(get['diff']=="no-res")
//{
if(document.getElementById("canvasR")!=null)
{
document.getElementById("canvasR").style.display="none";
document.getElementById("reserveText").style.display="none";
//}
}
if (get['mode'].includes('p'))
{
objPts=get['mode'].substring(0,get['mode'].length-1);

Loading…
Cancel
Save