MAJ du mode survie + ajout "patchnote"

master
adplantade 4 years ago
parent 707036af3d
commit dd2760adb4

1
.gitignore vendored

@ -1,2 +1,3 @@
code/data.db
code/data.db

@ -13,6 +13,9 @@ var selectedTheme="selectedDay";
var btn_options=document.getElementById("btn_options");
btn_options.width=size/2;
var btn_patchnote=document.getElementById("btn_patchnote");
btn_patchnote.width=size;
document.getElementById("btn_play").width=size/1.25;
document.getElementById("btn_play").style.display="inline";

@ -47,7 +47,7 @@
</ul>
<ul id="canvasR" class="flex-container">
<div id="reserveText">
<h1>R&eacute;serve</h1>
<h1 class="stats">R&eacute;serve</h1>
</div>
<canvas id="canvasR1" class="vitrail-vide"></canvas>
<canvas id="canvasR2" class="vitrail-vide"></canvas>
@ -65,8 +65,8 @@
<script src="bakery.js"></script>
<script src="chrono.js"></script>
<script src="timer.js"></script>
<script src="infoDisplayer.js"></script>
<script src="vitraux.js"></script>
<script src="infoDisplayer.js"></script>
<script src="themeSwitcher.js"></script>
</body>

@ -162,4 +162,14 @@
.mid {
margin: 5px;
}
.bg {
position: absolute;
bottom: 5px;
}
.patchnote {
border: none;
width: 100%;
}

@ -205,12 +205,28 @@ if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]
</ul>
</div>
<img id="btn_patchnote" src="./ress/button_patchnote.png" class="bg"/>
<div id="patchnote" class="modal">
<div class="modal-content" id="patchnoteContenu">
<span class="close" id="close_patchnote">&times;</span>
<p class="texte">Notes de mise à jour</p>
<!--<iframe src="patchnote1.txt" class="texte patchnote" id="patchnote_content"></iframe>-->
<?php
$ct=htmlspecialchars(file_get_contents("patchnote1.txt"));
$ct=str_replace("\n","<br/>",$ct);
//var_dump($ct);
echo '<p class="texte">'.$ct.'</p>';
?>
</div>
</div>
<!-- The Modal -->
<div id="optionsModal" class="modal">
<!-- Modal content -->
<div class="modal-content" id="modal">
<span class="close">&times;</span>
<span class="close" id="close_options">&times;</span>
<p class="texte ad">Options</p>
<div class="slidecontainer">
<div id="displays">
@ -266,6 +282,8 @@ if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]
<script src="bakery.js"></script>
<script src="button_displayer.js"></script>
<script src="options.js"></script>
<script src="patchnote.js"></script>
<script src="modals.js"></script>
<script src="themeSwitcher.js"></script>
<script>
dispDots();

@ -28,4 +28,9 @@ 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" : "avec pause");
function updateInfos()
{
mode.innerHTML = modeString + ", " + (get["diff"]=="easy" ? "facile" : (get["diff"]=="med" ? "moyen" : "difficile")) + "\n" + (getCookie("pause")==0 ? "pas de pause" : "avec pause");
}
updateInfos();

@ -0,0 +1,20 @@
// When the user clicks anywhere outside of the modalPatch, close it
window.onclick = function(event) {
if (event.target == modalPatch || event.target == modalOptions) {
console.log(modalPatch.style.display + " " + modalOptions.style.display);
modalPatch.style.display = "none";
modalOptions.style.display = "none";
console.log(modalPatch.style.display + " " + modalOptions.style.display);
}
}
// When the user clicks on <spanPatch> (x), close the modalPatch
spanPatch.onclick = function() {
modalPatch.style.display = "none";
}
// When the user clicks on <spanOptions> (x), close the modalOptions
spanOptions.onclick = function() {
modalOptions.style.display = "none";
}

@ -1,15 +1,15 @@
// Get the modal
var modal = document.getElementById("optionsModal");
// Get the modalOptions
var modalOptions = document.getElementById("optionsModal");
// Get the button that opens the modal
var btn = document.getElementById("btn_options");
// Get the button that opens the modalOptions
var btnOptions = document.getElementById("btn_options");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// Get the <spanOptions> element that closes the modalOptions
var spanOptions = document.getElementById("close_options");
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
// When the user clicks the button, open the modalOptions
btnOptions.onclick = function() {
modalOptions.style.display = "block";
document.getElementById("color_pickers").style.display= (displ!="points" ? "none" : "inline");
document.getElementById("gems_picker").style.display= (displ=="points" ? "none" : "inline");
document.getElementById(getCookie("displayMode")+"_di").classList.add(selectedTheme);
@ -20,18 +20,20 @@ btn.onclick = function() {
backgroundBoth();
}
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
/*
// When the user clicks on <spanOptions> (x), close the modalOptions
spanOptions.onclick = function() {
modalOptions.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
// When the user clicks anywhere outside of the modalOptions, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
if (event.target == modalOptions) {
modalOptions.style.display = "none";
modalPatch.style.display = "none";
}
}
}*/
document.getElementById("displays").addEventListener("click", function(){
@ -46,7 +48,7 @@ document.getElementById("displays").addEventListener("click", function(){
})
function saveOptions() {
modal.style.display = "none";
modalOptions.style.display = "none";
}
//initialisation des valeurs des préférences

@ -0,0 +1,36 @@
// Get the modalPatch
var modalPatch = document.getElementById("patchnote");
// Get the button that opens the modalPatch
var btnPatch = document.getElementById("btn_patchnote");
// Get the <spanPatch> element that closes the modalPatch
var spanPatch = document.getElementById("close_patchnote");
// When the user clicks the button, open the modalPatch
btnPatch.onclick = function() {
modalPatch.style.display = "block";
}
// When the user clicks on <spanPatch> (x), close the modalPatch
spanPatch.onclick = function() {
modalPatch.style.display = "none";
}
/*
// When the user clicks anywhere outside of the modalPatch, close it
window.onclick = function(event) {
if (event.target == modalPatch) {
modalPatch.style.display = "none";
modalOptions.style.display = "none";
}
}
// When the user clicks on <spanPatch> (x), close the modalPatch
spanPatch.onclick = function() {
modalPatch.style.display = "none";
}
*/
var content = document.getElementById("patchnote_content");
//content.style.width=modalPatch.width;

@ -0,0 +1,5 @@
Modification du mode survie :
- La difficulté devient "normal" en atteignant 30 points (si le mode "facile" avait été sélectionné)
- La difficulté devient "difficile" en atteignant 60 points (si le mode "facile" ou "normal" avait été sélectionné)
- Le nombre de secondes récupéré diminue au fil de la partie (une seconde de moins tous les 3 points gagnés, avec un minimum de 15/10/5 secondes selon le mode de difficulté)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -22,10 +22,14 @@ function applyLight(li) {
document.getElementById("logo").src="ress/logo_"+(li=="true" ? "clair" : "dark")+".png";
}
if(document.getElementById("modal")!=null)
listeModals=document.getElementsByClassName("modal-content");
if(listeModals[0]!=null)
{
document.getElementById("modal").classList.add((li=="true" ? "day" : "night"));
document.getElementById("modal").classList.remove((li=="true" ? "night" : "day"));
for(cpt=0;cpt<listeModals.length;cpt++)
{
listeModals[cpt].classList.add((li=="true" ? "day" : "night"));
listeModals[cpt].classList.remove((li=="true" ? "night" : "day"));
}
}
if(document.getElementById("resetGems")!=null)

@ -1,3 +1,4 @@
var difficulties=["easy","med","hard"];
var canvasT = document.getElementById('canvasTotal');
var ctxT = canvasT.getContext('2d');
@ -578,6 +579,15 @@ function checkAllOK(justChecking=false){
}
function handleSurvival()
{
difficulty=difficulties[Math.min(parseInt(points/20),2)];
updateInfos();
tpsPlus=Math.max(tpsPlus[1]-parseInt(points/3),tpsPlus[1]/3);
console.log(tpsPlus);
return tpsPlus;
}
function handleScore(modif)
{
points+=modif;
@ -600,7 +610,8 @@ function handleScore(modif)
}
else if(get['mode'].includes("s"))
{
addTime(tpsPlus[1]);
addTime(handleSurvival());
console.log("add time");
}
}

Loading…
Cancel
Save