From 8641448cd326277ea4e3e6b7dcbc128ccf51bdd3 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:39:33 +0100 Subject: show buttons on the board --- play.html | 28 ++++++++++++++++++++++++++++ play.js | 27 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/play.html b/play.html index 3b98ad5..00ee86f 100644 --- a/play.html +++ b/play.html @@ -282,6 +282,30 @@ div.congress_box.action { .piece.no { width: 42px; height: 32px; background-size: 42px 32px; background-image: url(pieces/no.svg); } .piece.congress { width: 32px; height: 32px; background-size: 32px 32px; background-image: url(pieces/cog.svg); } +div.button_box { + position: absolute; + box-sizing: border-box; + display: flex; + flex-direction: column; + flex-wrap: wrap; + justify-content: start; + gap: 4px; +} + +.button { + width: 40px; + height: 40px; + background-size: 40px 40px; + filter: drop-shadow(0px 1px 2px #0004); +} + +.button_1{background-image:url(images/badge1.png)} +.button_2{background-image:url(images/badge2.png)} +.button_3{background-image:url(images/badge3.png)} +.button_4{background-image:url(images/badge4.png)} +.button_5{background-image:url(images/badge5.png)} +.button_6{background-image:url(images/badge6.png)} + .card { background-size: cover; background-repeat: no-repeat; @@ -965,6 +989,10 @@ c5 3 13 7 17 8 8 2 9 3 11 12 1 5 5 12 8 16 5 8 5 8 3 22 l-3 14 -30 -1 c-35
+
+
+
+
diff --git a/play.js b/play.js index da42be1..ac11b1c 100644 --- a/play.js +++ b/play.js @@ -40,6 +40,11 @@ let ui = { document.getElementById("role_Opposition"), ], pieces: document.getElementById("pieces"), + pieces: document.getElementById("pieces"), + support_button_box: document.getElementById("support_buttons"), + support_buttons: [], + opposition_button_box: document.getElementById("opposition_buttons"), + opposition_buttons: [], campaigners: [], cubes: [], green_checks: [], @@ -392,6 +397,18 @@ function build_user_interface() { elt.addEventListener("click", on_click_congress) } + for (let i = 0; i < 12; ++i) { + elt = ui.support_buttons[i] = create("div", { + className: `button button_${(i % 4) + 1}`, + }) + } + + for (let i = 0; i < 6; ++i) { + elt = ui.opposition_buttons[i] = create("div", { + className: `button button_${(i % 2) + 1}`, + }) + } + for (let c = 1; c <= card_count; ++c) { elt = ui.cards[c] = create("div", { className: `card card_${c}`, @@ -594,6 +611,16 @@ function on_update() { // eslint-disable-line no-unused-vars ui.congress[c].classList.toggle("action", is_action("congress")) } + ui.support_button_box.replaceChildren() + for (let i = 0; i < view.support_buttons; ++i) { + ui.support_button_box.appendChild(ui.support_buttons[i]) + } + + ui.opposition_button_box.replaceChildren() + for (let i = 0; i < view.opposition_buttons; ++i) { + ui.opposition_button_box.appendChild(ui.opposition_buttons[i]) + } + document.getElementById("hand").replaceChildren() document.getElementById("support_claimed").replaceChildren() document.getElementById("support_discard").replaceChildren() -- cgit v1.2.3