From 23b5aaf4062756c2d04d7c70af3ee486678aa213 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 14 Sep 2024 15:57:22 +0200 Subject: Make events more forgiving for undo by adding pauses to roll/draw/etc. --- play.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'play.js') diff --git a/play.js b/play.js index b671484..3973ce6 100644 --- a/play.js +++ b/play.js @@ -408,6 +408,9 @@ let ui = { pieces: document.getElementById("pieces"), cards: document.getElementById("cards"), last_card: document.getElementById("last_card"), + bpa_reluctant: document.getElementById("bpa_reluctant"), + bpa_supportive: document.getElementById("bpa_supportive"), + bpa_enthusiastic: document.getElementById("bpa_enthusiastic"), space_list: [], } @@ -1005,6 +1008,10 @@ for (let p = 0; p < pieces.length; ++p) else build_unit(p) +ui.bpa_reluctant.onclick = () => send_action("reluctant") +ui.bpa_supportive.onclick = () => send_action("supportive") +ui.bpa_enthusiastic.onclick = () => send_action("enthusiastic") + document.getElementById("last_card").addEventListener("mouseenter", on_focus_last_card) document.getElementById("last_card").addEventListener("mouseleave", on_blur_last_card) @@ -1388,6 +1395,7 @@ function update_card(id) { card.element.classList.add('highlight') else card.element.classList.remove('highlight') + card.element.classList.toggle('selected', id === view.selected_card) if (view.hand.includes(id)) card.element.classList.add("show") else @@ -1440,6 +1448,10 @@ function update_map() { for (let i = 0; i < pieces.length; ++i) update_piece(i) + ui.bpa_reluctant.classList.toggle("highlight", !!(view.actions && view.actions.reluctant)) + ui.bpa_supportive.classList.toggle("highlight", !!(view.actions && view.actions.supportive)) + ui.bpa_enthusiastic.classList.toggle("highlight", !!(view.actions && view.actions.enthusiastic)) + if (focus && focus.length === 0) focus = null @@ -1545,6 +1557,9 @@ function update_map() { "PASS on playing \"Foul Weather\" for the rest of this ACTION PHASE?" ) + action_button("roll", "Roll") + action_button("draw", "Draw") + action_button("pass", "Pass") action_button("next", "Next") action_button("end_construction", "End construction") -- cgit v1.2.3