diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-11-02 20:36:16 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-11-02 20:36:39 +0100 |
commit | 1d073110c0937e2a057efd0eeeef5223036c1187 (patch) | |
tree | 696edad37a9038ae2257cacbb42fe1c1b90c827d | |
parent | 1640855336f524cf44f61571b0bb25c10f70c34b (diff) | |
download | 1989-dawn-of-freedom-1d073110c0937e2a057efd0eeeef5223036c1187.tar.gz |
Highlight selected space.
-rw-r--r-- | play.css | 5 | ||||
-rw-r--r-- | play.js | 3 | ||||
-rw-r--r-- | rules.js | 17 |
3 files changed, 11 insertions, 14 deletions
@@ -90,6 +90,11 @@ body.Communist header.your_turn { background-color: hsl(355, 70%, 75%); } .space.Romania.action { border-color: peachpuff; } .space.Bulgaria.action { border-color: palegreen; } +.space.selected { + border-color: aqua; + box-shadow: 0 0 0 1px black, inset 0 0 0 1px black; +} + .space.tip { border-color: lime; box-shadow: 0 0 0 1px black, inset 0 0 0 1px black; @@ -715,6 +715,9 @@ function on_update() { for (let e of action_register) e.classList.toggle("action", is_action(e.my_action, e.my_id)) + for (let s = 0; s <= last_space; ++s) + ui.spaces[s].classList.toggle("selected", view.selected_space === s) + action_button("yes", "Yes") action_button("no", "No") action_button("start", "Start") @@ -387,19 +387,8 @@ exports.view = function(state, player) { view.drawn = game.vm.draw if (player === game.active) { - if (game.selected_space) { - view.valid_spaces = [game.selected_space] - } else { - view.valid_spaces = game.valid_spaces - } - } else { - view.valid_spaces = [] - } - - if (player === game.active) { - view.valid_cards = game.valid_cards - } else { - view.valid_cards = [] + if (game.selected_space >= 0) + view.selected_space = game.selected_space } if (player === DEM) { @@ -422,7 +411,7 @@ exports.view = function(state, player) { if (game.state === "game_over") { view.prompt = game.victory - } else if (player === "Observer" || (game.active !== player && game.active !== "Both")) { + } else if (game.active !== player) { if (states[game.state]) { let inactive = states[game.state].inactive if (typeof inactive === "function") |