From f325e1673fa843d06e47ef1ce558ea6606b3c92b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 22 Aug 2024 10:50:56 +0200 Subject: Space ordering. --- play.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index f601076..991bf75 100644 --- a/play.js +++ b/play.js @@ -5,7 +5,6 @@ */ // TODO: show "reshuffle" flag next to card deck display -// TODO: improve animations by having one CU stack per general and one CU stack per space function toggle_counters() { // Cycle between showing everything, only markers, and nothing. @@ -19,7 +18,6 @@ function toggle_counters() { } } - /* COMMON */ function lerp(a, b, t) { @@ -59,6 +57,7 @@ const CARDS = data.cards const P_BRITAIN = "Britain" const P_AMERICA = "America" +const F_RESHUFFLE = 1 const F_REGULARS = 2 const F_EUROPEAN_WAR = 4 const F_MUTINIES = 16 @@ -156,7 +155,10 @@ let ui = { header: document.querySelector("header"), status: document.getElementById("status"), + turn_info: document.getElementById("turn_info"), + war_ends: document.getElementById("war_ends"), last_played: document.getElementById("last_played"), + reshuffle: document.getElementById("reshuffle"), hand: document.getElementById("hand"), map: document.getElementById("map"), spaces_element: document.getElementById("spaces"), @@ -225,11 +227,11 @@ function build_piece(cn, w, h) { } function on_init() { - document.getElementById("war_ends").addEventListener("mouseenter", on_focus_war_ends) - document.getElementById("war_ends").addEventListener("mouseleave", on_blur_war_ends) + ui.war_ends.addEventListener("mouseenter", on_focus_war_ends) + ui.war_ends.addEventListener("mouseleave", on_blur_war_ends) - document.getElementById("last_played").addEventListener("mouseenter", on_focus_last_played) - document.getElementById("last_played").addEventListener("mouseleave", on_blur_last_played) + ui.last_played.addEventListener("mouseenter", on_focus_last_played) + ui.last_played.addEventListener("mouseleave", on_blur_last_played) for (let c = 0; c <= 110; ++c) { let e = ui.cards[c] = document.createElement("div") @@ -703,6 +705,7 @@ function on_update() { toggle_marker(ui.a_colony[i], control > 0) } + ui.reshuffle.classList.toggle("hide", !(view.flags & F_RESHUFFLE)) ui.turn_marker.classList.toggle("no_regulars", !(view.flags & F_REGULARS)) ui.french_alliance.classList.toggle("european_war", !!(view.flags & F_EUROPEAN_WAR)) -- cgit v1.2.3