diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-17 11:49:07 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-17 11:49:07 +0000 |
commit | cb1d0d639e9e62054b8b3f3b4b2f464fb71bbf19 (patch) | |
tree | 648ca9a515925f7403d9b3b0b35e9a5a8bb645b1 /play.js | |
parent | c86eb75d757a0c30e54544e19aea3fc8260cb49d (diff) | |
download | 1989-dawn-of-freedom-cb1d0d639e9e62054b8b3f3b4b2f464fb71bbf19.tar.gz |
Third set of influence markers for influence over 16
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 34 |
1 files changed, 29 insertions, 5 deletions
@@ -396,7 +396,7 @@ function create_country(id, name) { document.getElementById("markers").appendChild(e) } -const INF_DX = 35 +const INF_DX = 33 const INF_DY = 10 function create_ui() { @@ -406,6 +406,8 @@ function create_ui() { ui.com_inf = [] ui.dem_inf2 = [] ui.com_inf2 = [] + ui.dem_inf3 = [] + ui.com_inf3 = [] for (let s = 0; s <= last_space; ++s) { let info = spaces[s] @@ -440,6 +442,12 @@ function create_ui() { com_e2.style.top = yc + 12 - 25 + INF_DY + "px" ui.com_inf2[s] = com_e2 + let com_e3 = document.createElement("div") + com_e3.className = "marker comInfl hide" + com_e3.style.left = xc + 32 - 25 + 5 + INF_DX + "px" + com_e3.style.top = yc + 12 - 25 + 5 + INF_DY + "px" + ui.com_inf3[s] = com_e3 + let dem_e = document.createElement("div") dem_e.className = "marker demInfl hide" dem_e.style.left = xc - 32 - 25 + "px" @@ -452,11 +460,19 @@ function create_ui() { dem_e2.style.top = yc + 12 - 25 + INF_DY + "px" ui.dem_inf2[s] = dem_e2 + let dem_e3 = document.createElement("div") + dem_e3.className = "marker demInfl hide" + dem_e3.style.left = xc - 32 - 25 - 5 - INF_DX + "px" + dem_e3.style.top = yc + 12 - 25 + 5 + INF_DY + "px" + ui.dem_inf3[s] = dem_e3 + document.getElementById("spaces").append(space_e) document.getElementById("markers").appendChild(com_e) document.getElementById("markers").appendChild(com_e2) + document.getElementById("markers").appendChild(com_e3) document.getElementById("markers").appendChild(dem_e) document.getElementById("markers").appendChild(dem_e2) + document.getElementById("markers").appendChild(dem_e3) } ui.cards = [] @@ -579,18 +595,26 @@ function layout_country(id) { } } -function layout_inf_markers(cn, one, two, v, ctl) { +function layout_inf_markers(cn, one, two, three, v, ctl) { if (ctl) cn += " ctl" - if (v > 8) { + if (v > 16) { + one.className = cn + " v" + 8 + two.className = cn + " v" + 8 + three.className = cn + " v" + (v - 16) + } + else if (v > 8) { one.className = cn + " v" + 8 two.className = cn + " v" + (v - 8) + three.className = "hide" } else if (v > 0) { one.className = cn + " v" + v two.className = "hide" + three.className = "hide" } else { one.className = "hide" two.className = "hide" + three.className = "hide" } } @@ -659,8 +683,8 @@ function on_update() { for (let s = 0; s <= last_space; ++s) { const demInfl = view.demInfl[s] const comInfl = view.comInfl[s] - layout_inf_markers("marker demInfl", ui.dem_inf[s], ui.dem_inf2[s], demInfl, demInfl - comInfl >= spaces[s].stability) - layout_inf_markers("marker comInfl", ui.com_inf[s], ui.com_inf2[s], comInfl, comInfl - demInfl >= spaces[s].stability) + layout_inf_markers("marker demInfl", ui.dem_inf[s], ui.dem_inf2[s], ui.dem_inf3[s], demInfl, demInfl - comInfl >= spaces[s].stability) + layout_inf_markers("marker comInfl", ui.com_inf[s], ui.com_inf2[s], ui.com_inf3[s], comInfl, comInfl - demInfl >= spaces[s].stability) } // UPDATE COUNTRY MARKERS |