From f5b6cfd571ba1599b51daab96ada37fcb6111edf Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 17 May 2023 23:44:45 +0200 Subject: Tweak UI colors. --- play.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'play.js') 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) -- cgit v1.2.3