From fcd901e788cacf3d76080636f714defeb184caa2 Mon Sep 17 00:00:00 2001 From: Flummi Date: Sat, 11 Aug 2018 12:12:18 +0200 Subject: [PATCH] blah --- src/index.mjs | 8 +++++- src/static/css/main.css | 37 ++++++++++++++++------------ src/static/index.html | 8 +++--- src/static/js/events.js | 10 +++++--- src/static/js/game.js | 54 +++++++++++++++++++++++++++++++++++++++++ src/static/js/main.js | 49 +++---------------------------------- src/static/js/render.js | 53 ++++++++++++++++++---------------------- src/static/js/socket.js | 19 ++++++++++++--- 8 files changed, 137 insertions(+), 101 deletions(-) create mode 100644 src/static/js/game.js diff --git a/src/index.mjs b/src/index.mjs index 9be9a0a..fdec3ba 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -22,7 +22,13 @@ const fillHand = (room, player) => { player.hand.push(...room.deck.splice(0, cfg.iters.hand - player.hand.length)); player.hand.sort((a, b) => a > b); }; -const begin = room => room.player.forEach(player => fillHand(room, player.cards)); +const fillStock = (room, player) => { + player.stock.push(...room.deck.splice(0, cfg.iters.stock)); +}; +const begin = room => room.player.forEach(player => { + fillHand(room, player.cards); + fillStock(room, player.cards); +}); const app = express(); const server = http.Server(app); diff --git a/src/static/css/main.css b/src/static/css/main.css index 20d29c2..25e5a52 100644 --- a/src/static/css/main.css +++ b/src/static/css/main.css @@ -44,8 +44,11 @@ html, body { font-weight: bold; } -.pile { +#player2 > .pile, #player3 > .pile { width: 95%; +} +.pile { + /*width: 95%;*/ margin: auto; height: 160px; display: grid; @@ -218,7 +221,6 @@ html, body { #spielfeld { height: 100vh; - } #player { @@ -242,33 +244,38 @@ html, body { } #player_self { - width: 95%; + width: 650px; border-top-left-radius: 10px; border-top-right-radius: 10px; border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; border-style: solid solid none solid; - height: 200px; + height: 350px; position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); - - display: grid; - grid-template-columns: repeat(2, 1fr); - grid-template-rows: 1fr auto; - grid-template-areas: "a a" "b c"; } #player1_name { - grid-area: a; -} -#player1_hand { - grid-area: b; - grid-template-columns: repeat(5, 1fr) !important; + width: 100%; + position: absolute; + top: 0; } #player1_pile { - grid-area: c; + width: 95%; + position: absolute; + top: 21px; + left: 50%; + transform: translateX(-50%); +} +#player1_hand { + width: 95%; + grid-template-columns: repeat(5, 1fr) !important; + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); } diff --git a/src/static/index.html b/src/static/index.html index 527abc8..9cd2d65 100644 --- a/src/static/index.html +++ b/src/static/index.html @@ -5,7 +5,7 @@ -