diff --git a/src/Model/Const.js b/src/Model/Const.js index 858eec3..200c05d 100755 --- a/src/Model/Const.js +++ b/src/Model/Const.js @@ -15,8 +15,8 @@ const SHAPE_PATH = { }; const OUTLINE_SPEC = { - full: {}, - dot: { "stroke-dasharray": "1 20", "stroke-linecap": "round" }, + continuous: {}, + dot: { "stroke-dasharray": "1 25", "stroke-linecap": "round" }, rect: { "stroke-dasharray": 70 }, spade: { "stroke-dasharray": "10 15", "stroke-width": 40 }, sharp: {} diff --git a/src/Model/Deck.js b/src/Model/Deck.js index 8027e35..d28a0c0 100755 --- a/src/Model/Deck.js +++ b/src/Model/Deck.js @@ -30,6 +30,7 @@ class Deck { createDeck(nbCards) {//toTest⌛when more than 12c to d't add other cards if (this.remainingCards.length < this.nbCards) {// no more cards console.log("PLUS DE CARTES"); + return 2; } else { let nbSets = setsCounter(this.outputCards, this.nbCards); @@ -88,7 +89,6 @@ class Deck { this.removeFromoutputCards(selectedCards); return 1; } - } } else{// pas un set return -1; @@ -117,7 +117,7 @@ class Deck { } else { this.setMade.push(set); - this.createDeck(this.nbCards) + return this.createDeck(this.nbCards) } } } diff --git a/src/Model/Factory.js b/src/Model/Factory.js index d75e7ef..914245c 100755 --- a/src/Model/Factory.js +++ b/src/Model/Factory.js @@ -81,9 +81,10 @@ class Factory{ let attributes=this.attributesName(dicoAttributes); let nbAttributes=this.nbAttr; if(attributes.length==3){ - for (let c=0; c \ No newline at end of file diff --git a/views/deck-module.js b/views/deck-module.js index b40dc39..d7b9dcd 100644 --- a/views/deck-module.js +++ b/views/deck-module.js @@ -9,12 +9,13 @@ export default{ return{ card:new Card({"filling":"empty"}), id:0, - deck : new Deck([0,1,2,3],3), + deck : new Deck([0,1,2],3), selectedCards:[], selectedCardsindex:[], nbCardsSelected:0, connected:'7/8', timer:'10.51', + win:false, } }, methods:{ @@ -22,11 +23,11 @@ export default{ if(this.nbCardsSelected>=this.deck.nbCards){ this.set(); } - else{ - if(this.selectedCards[id]!=null){ + else{// pas suffisament de cartes pour un set + if(this.selectedCards[id]!=null){// carte déja selectionnée document.querySelector(`#id${id}`).setAttribute("style","border: none;cursor: pointer;"); this.nbCardsSelected-=1 - this.selectedCards[id]=null + delete this.selectedCards[id]//pb this.selectedCardsindex.splice(this.selectedCardsindex.indexOf(id),1) } else{ @@ -41,9 +42,10 @@ export default{ } }, set(){ + console.log("this.selectedCards",this.selectedCards) let checkSet=this.deck.checkSet(this.selectedCards); - if(checkSet){//is set - + if(checkSet==2){//is set + this.win=true; } // remove red outline this.selectedCardsindex.forEach((e) => { @@ -51,8 +53,8 @@ export default{ }) // flush array this.nbCardsSelected=0; - this.selectedCards.splice(0,this.selectedCards.length+1) - this.selectedCardsindex.splice(0,this.selectedCardsindex.length+1) + this.selectedCards=[] + this.selectedCardsindex=[] }, }, template:` @@ -63,8 +65,11 @@ export default{

Players: {{connected}}

-
+
+
+

Félicitations, vous venez de gagner la partie ! 🎉

+
` } \ No newline at end of file