diff --git a/doc/newClassDiagram.md b/doc/newClassDiagram.md new file mode 100644 index 0000000..dbc29e9 --- /dev/null +++ b/doc/newClassDiagram.md @@ -0,0 +1,18 @@ +# Class diagram + +```mermaid + +--- +title: Diagramme de classe final (ne prenant en compte que les "cards") +--- + +classDiagram + + + class Card{ + attributes + +getAttributes() + +isEqual() + } + +``` diff --git a/doc/oldClassDiagram copy.md b/doc/oldClassDiagram copy.md new file mode 100644 index 0000000..c32b951 --- /dev/null +++ b/doc/oldClassDiagram copy.md @@ -0,0 +1,62 @@ +# Class diagram + +```mermaid + +--- +title: Diagramme de classe initial (ne prenant en compte que les "cards") +--- + +classDiagram + Card <|-- Card4WithNoOutline + Card <|-- Card4WithNoShape + Card <|-- Card4WithNoNumber + Card <|-- Card4WithNoColor + Card <|-- Card4WithNoFilling + + + class Card{ + +getAttributes() + +isEqual() + } + class Card4WithNoOutline{ + -string color + -string shape + -string number + -string filling + +getAttributes() + +isEqual() + } + class Card4WithNoShape{ + -string color + -string outline + -string number + -string filling + +getAttributes() + +isEqual() + } + class Card4WithNoColor{ + -string outline + -string shape + -string number + -string filling + +getAttributes() + +isEqual() + } + class Card4WithNoNumber{ + -string color + -string shape + -string outline + -string filling + +getAttributes() + +isEqual() + } + class Card4WithNoFilling{ + -string color + -string shape + -string number + -string outline + +getAttributes() + +isEqual() + } + +``` diff --git a/styles/game.css b/styles/game.css new file mode 100644 index 0000000..95f7b7f --- /dev/null +++ b/styles/game.css @@ -0,0 +1,11 @@ +.description{ + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin: 2rem 4rem 2rem 4rem; +} + +h2{ + font-size: 28px; +} \ No newline at end of file diff --git a/views/card-module.js b/views/card-module.js new file mode 100644 index 0000000..5e737e9 --- /dev/null +++ b/views/card-module.js @@ -0,0 +1,20 @@ +export default{ + emits:['selected'], + props: ['card','id'], + data: function(){ + return{ + idUsed:"id"+this.id, + isClicked:false, + } + }, + methods:{ + clicked() { + this.$emit('selected',this.id); + } + }, + template:` +
+ {{card.attributes}} +
+ ` +} \ No newline at end of file diff --git a/views/deck-module.js b/views/deck-module.js new file mode 100644 index 0000000..ffa7a17 --- /dev/null +++ b/views/deck-module.js @@ -0,0 +1,69 @@ +export default{ + emits:[], + props:{ + deckR:Deck, + idRoom:String, + mode:String//true for chrono + }, + data: function(){ + return{ + card:new Card({"filling":"empty"}), + id:0, + deck : new Deck([0,1,2,3],3), + selectedCards:[], + nbCardsSelected:0, + connected:'7/8', + timer:'10.51', + } + }, + methods:{ + selected(id){ + if(this.nbCardsSelected>=this.deck.nbCards){ + this.set(); + console.log("deb") + } + else{ + if(this.selectedCards[id]!=null){ + console.log("deselec") + document.querySelector(`#id${id}`).setAttribute("style","border: 2px solid black; color: red; fontSize: 20px; cursor: pointer; width:100%; height:100%"); + this.nbCardsSelected-=1 + this.selectedCards[id]=null + } + else{ + console.log("Selec") + this.selectedCards[id]=this.deck.outputCards[id-1] + document.querySelector(`#id${id}`).setAttribute("style","border: 2px solid red; color: red; fontSize: 20px; cursor: pointer; width:100%; height:100%"); + this.nbCardsSelected+=1 + if(this.nbCardsSelected==this.deck.nbCards){ + console.log("this.selectedCards.length",this.selectedCards.length) + this.set(); + } + } + } + }, + set(){ + console.log("Check Set") + let checkSet=true; + if(checkSet){ + console.log("this.selectedCards.length",this.selectedCards.length) + this.deck.checkSet(this.selectedCards); + this.nbCardsSelected=0; + this.selectedCards.splice(0,this.selectedCards.length+1) + } + }, + }, + template:` +
+

Room: {{idRoom}}

+

{{timer}}

+

Remaining cards: {{deck.remainingCards.length}}/{{deck.allCards.length}}

+

Players: {{connected}}

+
+ +
+
+ +
+
+ ` +} \ No newline at end of file diff --git a/views/game.html b/views/game.html index f692682..a18093e 100644 --- a/views/game.html +++ b/views/game.html @@ -8,21 +8,22 @@ +
-

Game - test

+
@@ -33,7 +34,10 @@