From 6c7e7ec61d51b65205dc17ff1a0e9a7e094dcad2 Mon Sep 17 00:00:00 2001 From: gwen Date: Thu, 29 Feb 2024 16:12:01 +0100 Subject: [PATCH 01/10] typo --- science-quest/src/components/jeux/pendu/Pendu.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/science-quest/src/components/jeux/pendu/Pendu.vue b/science-quest/src/components/jeux/pendu/Pendu.vue index fcc41c3..74fbb9a 100644 --- a/science-quest/src/components/jeux/pendu/Pendu.vue +++ b/science-quest/src/components/jeux/pendu/Pendu.vue @@ -38,8 +38,6 @@ export default{ this.nbLettresADeviner = this.motADeviner.length this.description = scientifiqueADeviner.descriptif - this.viesRestantes = 10; // TODO utiliser l'api - //verifier que le mot a deviner ne contient pas des lettres exemptées this.lettresDejaDevine = ""; this.lettresANePasFaireDevinerAuJoueur=""; @@ -96,8 +94,8 @@ export default{ this.motADeviner.split("").forEach(w =>lettresAAfficher.includes(w) ? progression += w : progression += "_"); return progression; }, - intAleatoire: function(nbPages){ - return Math.floor(Math.random() * nbPages) + intAleatoire: function(nb){ + return Math.floor(Math.random() * nb) } }, components: { PenduDessin } From 6195a9e51bbd232823b1e1b83dc0c2e72db1d5cd Mon Sep 17 00:00:00 2001 From: gwen Date: Thu, 29 Feb 2024 16:20:08 +0100 Subject: [PATCH 02/10] enlever la remise a zero des variables du traitement de la reponse --- science-quest/src/components/jeux/pendu/Pendu.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/science-quest/src/components/jeux/pendu/Pendu.vue b/science-quest/src/components/jeux/pendu/Pendu.vue index 74fbb9a..ad7fff7 100644 --- a/science-quest/src/components/jeux/pendu/Pendu.vue +++ b/science-quest/src/components/jeux/pendu/Pendu.vue @@ -26,7 +26,10 @@ export default{ }, methods: { creerPartie: function () { + //remettre a zero les variables this.lettresDejaDevine = ""; + this.lettresANePasFaireDevinerAuJoueur=""; + //appeler l'API fetch(`${REST_API}/scientifiques?page=`+this.intAleatoire(this.api_pagesMaximum)).then(response=>{ response.json().then(json=>{ @@ -39,8 +42,6 @@ export default{ this.description = scientifiqueADeviner.descriptif //verifier que le mot a deviner ne contient pas des lettres exemptées - this.lettresDejaDevine = ""; - this.lettresANePasFaireDevinerAuJoueur=""; this.motADeviner.split("").forEach(lettre=> this.regexExceptions.forEach(regex=>regex.test(lettre) ? this.lettresANePasFaireDevinerAuJoueur+=lettre /* faire jouer la lettre a la place de l'utilisateur */ : null) ) From 5760d158ee3051f1e5f6a62cf9668496d7e6f98c Mon Sep 17 00:00:00 2001 From: gwen Date: Thu, 29 Feb 2024 16:23:34 +0100 Subject: [PATCH 03/10] remettre vies restantes --- science-quest/src/components/jeux/pendu/Pendu.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/science-quest/src/components/jeux/pendu/Pendu.vue b/science-quest/src/components/jeux/pendu/Pendu.vue index ad7fff7..7ecbb62 100644 --- a/science-quest/src/components/jeux/pendu/Pendu.vue +++ b/science-quest/src/components/jeux/pendu/Pendu.vue @@ -26,9 +26,9 @@ export default{ }, methods: { creerPartie: function () { - //remettre a zero les variables this.lettresDejaDevine = ""; this.lettresANePasFaireDevinerAuJoueur=""; + this.viesRestantes=10; //appeler l'API fetch(`${REST_API}/scientifiques?page=`+this.intAleatoire(this.api_pagesMaximum)).then(response=>{ From 061129a494e604fed47e5ef6bcb635499d9616ab Mon Sep 17 00:00:00 2001 From: gwen Date: Thu, 29 Feb 2024 16:59:32 +0100 Subject: [PATCH 04/10] ajouter dessin --- science-quest/src/components/jeux/pendu/Pendu.vue | 5 ++--- science-quest/src/components/jeux/pendu/PenduDessin.vue | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/science-quest/src/components/jeux/pendu/Pendu.vue b/science-quest/src/components/jeux/pendu/Pendu.vue index 7ecbb62..1b733b2 100644 --- a/science-quest/src/components/jeux/pendu/Pendu.vue +++ b/science-quest/src/components/jeux/pendu/Pendu.vue @@ -59,7 +59,6 @@ export default{ this.premierePartie = false; }, deviner: function (event) { - //TODO revoir ce truc //prendre la lettre depuis l'event const lettreDevinee = event.data.toLowerCase(); //vider l'input @@ -76,7 +75,7 @@ export default{ if (oldprogression == this.progression) { //si on n'a pas progressé = lettre incorrecte this.viesRestantes--; //l'api devrait aussi retourner le nombre de vies restantes - + if(this.viesRestantes<0){ this.partieTerminee = true this.progression = this.afficherProgression(); @@ -125,7 +124,7 @@ export default{
- +
diff --git a/science-quest/src/components/jeux/pendu/PenduDessin.vue b/science-quest/src/components/jeux/pendu/PenduDessin.vue index 6101817..3c62e28 100644 --- a/science-quest/src/components/jeux/pendu/PenduDessin.vue +++ b/science-quest/src/components/jeux/pendu/PenduDessin.vue @@ -1,6 +1,6 @@