From 1177bb38895a8b2e0c285e2ef2b97f45db554b22 Mon Sep 17 00:00:00 2001 From: RemRem Date: Mon, 13 Mar 2023 16:24:47 +0100 Subject: [PATCH] a lot of things: repair code, room.css ... --- .gitignore | 2 ++ index.html | 2 +- src/Model/Card.js | 5 +++- src/Model/card-to-html.js | 15 ++++++++---- styles/room.css | 49 +++++++++++++++++++++++++++++++++++++++ views/cards-test.html | 24 ++++++++++--------- views/room.html | 18 ++++++++++---- 7 files changed, 92 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index e69de29..8afcc63 100755 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +# because you don't need to know what's in here +note.txt diff --git a/index.html b/index.html index 04d117e..0a29d5e 100755 --- a/index.html +++ b/index.html @@ -37,7 +37,7 @@ diff --git a/src/Model/Card.js b/src/Model/Card.js index 864bac6..51456ad 100755 --- a/src/Model/Card.js +++ b/src/Model/Card.js @@ -1,11 +1,13 @@ -class Card{ +class Card { /** * * @param {*} attributes : dictionnary of attributes : key : name of the attributes and value : value of the attributes */ + // attributes : shape, color, number, outline, filling constructor(attributes){ this.attributes=attributes; } + /** * * @returns all attributes of a card @@ -17,6 +19,7 @@ class Card{ }); return att; } + /** * * @param {*} card card to be compared with the current obj diff --git a/src/Model/card-to-html.js b/src/Model/card-to-html.js index 048befd..bfd0957 100755 --- a/src/Model/card-to-html.js +++ b/src/Model/card-to-html.js @@ -13,12 +13,13 @@ class CardToHtml { // Create paths + add to svg for(let j = 0; j < 2; j++) { - const path = this.createPath(card.shape,card.color,card.filling,card.outline,j); + // Faut pas oublier le j à la fin hein, c'est pas une typo + const path = this.createPath(card.attributes['shape'], card.attributes['color'], card.attributes['filling'], card.attributes['outline'], j); svg.appendChild(path); } // Loop to add svg card.number times - for(let i = 0; i < card.number; i++) { + for(let i = 0; i < card.attributes['number']; i++) { div.appendChild(svg.cloneNode(true)) } @@ -33,6 +34,11 @@ class CardToHtml { if(color === null) color = '000000'; if(filling === null) filling = 'fill'; + // console.log("shape: " + shape); + // console.log("color: " + color); + // console.log("filling: " + filling); + // console.log("outline: " + outline); + // Add lots of attributes path.setAttribute("d",SHAPE_PATH[shape]); path.setAttribute('stroke',`#${color}`); @@ -45,11 +51,10 @@ class CardToHtml { } // Add svg attributes for shape outline - if(outline !== null){ - Object.keys(OUTLINE_SPEC[outline]).forEach(function(k){ + if(outline !== null) { + Object.keys(OUTLINE_SPEC[outline]).forEach(function(k) { path.setAttribute(k,OUTLINE_SPEC[outline][k]); }); - path.setAttribute('stroke','#000000'); } diff --git a/styles/room.css b/styles/room.css index e69de29..63ae76e 100644 --- a/styles/room.css +++ b/styles/room.css @@ -0,0 +1,49 @@ +body { + display: flex; + flex-direction: row; + background-color: rebeccapurple; +} + +section { + display: flex; + flex-direction: column; + height: 100vh; + width: 50vw; +} + +#right-section { + background-color: aqua; +} + +#left-section { + background-color: white; +} + +button { + display: flex; + justify-content: center; + align-items: center; + padding: 1.2em; + background-color: white; + border: 0.2rem solid black; + border-radius: 0.5em; + font-family: var(--font); + font-size: 1.5em; +} + +#or { + font-family: var(--font); + font-size: 4rem; + font-weight: bolder; + color: black; +} + +.sub-title { + font-family: var(--font); + font-size: 1.6em; + font-weight: bold; +} + +input[type="checkbox"] { + +} \ No newline at end of file diff --git a/views/cards-test.html b/views/cards-test.html index f1e7825..a896c87 100755 --- a/views/cards-test.html +++ b/views/cards-test.html @@ -83,7 +83,7 @@ - \ No newline at end of file diff --git a/views/room.html b/views/room.html index a113e57..391111e 100644 --- a/views/room.html +++ b/views/room.html @@ -8,19 +8,19 @@ -
+
- OR + OR - Card number to make a set + Card number to make a set
3 4 5
- Attributes to play with + Attributes to play with
number color @@ -30,7 +30,7 @@
-
+
Game parameters Private @@ -38,6 +38,14 @@ HyperSet +
+ List of player in room: + Aurianus + Basuw + Raph + Remrem +
+