summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-17 23:44:45 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-24 21:06:18 +0200
commitf5b6cfd571ba1599b51daab96ada37fcb6111edf (patch)
treecb42c0b19c67e5b68a17a39bd70940fc85706447 /play.js
parent46df92e32355428b00674a1b7670f5ca73493bb3 (diff)
downloadred-flag-over-paris-f5b6cfd571ba1599b51daab96ada37fcb6111edf.tar.gz
Tweak UI colors.
Diffstat (limited to 'play.js')
-rw-r--r--play.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/play.js b/play.js
index fe3d55c..3a91056 100644
--- a/play.js
+++ b/play.js
@@ -427,14 +427,14 @@ function on_log(text) {
return p
}
-function on_update_objective(panel, parent, objective) {
+function on_update_objective(panel, parent, objective, i) {
if (typeof objective === "object") {
for (let c of objective)
parent.appendChild(ui.cards[c])
} else if (objective === 1) {
- parent.appendChild(ui.objective_back[0])
+ parent.appendChild(ui.objective_back[i])
} else if (objective === 2) {
- parent.appendChild(ui.objective_back[0])
+ parent.appendChild(ui.objective_back[i])
} else if (objective > 2) {
parent.appendChild(ui.cards[objective])
}
@@ -476,16 +476,20 @@ function on_update() {
if (view.red_final)
document.getElementById("final").appendChild(ui.cards[view.red_final])
- on_update_objective(document.getElementById("blue_objective_panel"), document.getElementById("blue_objective"), view.blue_objective)
+ on_update_objective(document.getElementById("blue_objective_panel"), document.getElementById("blue_objective"), view.blue_objective, 0)
- on_update_objective(document.getElementById("red_objective_panel"), document.getElementById("red_objective"), view.red_objective)
+ on_update_objective(document.getElementById("red_objective_panel"), document.getElementById("red_objective"), view.red_objective, 1)
if (view.discard)
document.getElementById("discard").appendChild(ui.cards[view.discard])
- if (view.hand)
+ if (view.hand) {
+ document.getElementById("hand_panel").classList.remove("hide")
for (let c of view.hand)
document.getElementById("hand").appendChild(ui.cards[c])
+ } else {
+ document.getElementById("hand_panel").classList.add("hide")
+ }
if (view.set_aside) {
document.getElementById("set_aside_panel").classList.remove("hide")
for (let c of view.set_aside)