From 5418158479638ed3a32110c7afbffb0a4d6902de Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 15 Oct 2024 23:56:22 +0200 Subject: turn marker --- play.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/play.js b/play.js index ce98e12..087f307 100644 --- a/play.js +++ b/play.js @@ -538,6 +538,9 @@ function on_init() { ui.tcbreak = document.createElement("div") ui.tcbreak.className = "draw-break" + ui.turn = document.createElement("div") + ui.turn.className = "marker turn_marker" + ui.political = [] for (let fc = 0; fc <= 18; ++fc) ui.political[fc] = make_political_card(fc) @@ -809,6 +812,19 @@ function layout_combat_marker() { ui.combat.style.top = y - 20 + "px" } +function layout_turn_marker() { + if (view.turn > 0) { + let t = view.turn - 1 + let row = (t / 3) | 0 + let col = (t % 3) + let x = 2267 + col * 45 + let y = 79 + row * 52 + ui.turn.style.left = x - 16 + "px" + ui.turn.style.top = y - 16 + "px" + ui.markers_element.appendChild(ui.turn) + } +} + function create_conquest(style, s) { let x = data.cities.x[s] let y = data.cities.y[s] @@ -943,6 +959,8 @@ function on_update() { ui.markers_element.appendChild(ui.retro[s]) */ + layout_turn_marker() + if (view.attacker !== undefined && view.defender !== undefined) { ui.markers_element.appendChild(ui.combat) layout_combat_marker() -- cgit v1.2.3