summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-08-22 10:50:56 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-22 22:02:58 +0200
commitf325e1673fa843d06e47ef1ce558ea6606b3c92b (patch)
tree12c98696bcc3240726a13df4c8b1fa742f847ef3 /play.js
parenteb9f45cf055f9f9823eed3aeaefada74f6d07454 (diff)
downloadwashingtons-war-f325e1673fa843d06e47ef1ce558ea6606b3c92b.tar.gz
Space ordering.
Diffstat (limited to 'play.js')
-rw-r--r--play.js15
1 files changed, 9 insertions, 6 deletions
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))