From 763118f70215a0b736349431efcb4a8dab6947cb Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 26 Jan 2023 19:54:14 +0100 Subject: Tweak battle layout. --- images/garrison.svg | 3 +++ images/garrison_attacker.svg | 5 ----- images/garrison_defender.svg | 3 --- play.html | 38 +++++++++++++++----------------------- play.js | 34 ++++++++++++++-------------------- 5 files changed, 32 insertions(+), 51 deletions(-) create mode 100644 images/garrison.svg delete mode 100644 images/garrison_attacker.svg delete mode 100644 images/garrison_defender.svg diff --git a/images/garrison.svg b/images/garrison.svg new file mode 100644 index 0000000..ec79240 --- /dev/null +++ b/images/garrison.svg @@ -0,0 +1,3 @@ + + + diff --git a/images/garrison_attacker.svg b/images/garrison_attacker.svg deleted file mode 100644 index 36a4998..0000000 --- a/images/garrison_attacker.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/images/garrison_defender.svg b/images/garrison_defender.svg deleted file mode 100644 index ec79240..0000000 --- a/images/garrison_defender.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/play.html b/play.html index 9e459a3..fbfbaea 100644 --- a/play.html +++ b/play.html @@ -135,21 +135,11 @@ body.Teutons #plan_actions .russian { display: none } #battle_grid .grid_array { width: 376px; height: 506px; - padding: 12px; + padding: 36px 12px 12px 12px; } -#battle_grid #grid_ga { - height: auto; - min-height: 80px; -} - -#battle_grid #grid_sw { - height: auto; -} - -#battle_grid #grid_sw:empty { - display: none; -} +#battle_grid #grid_ga { height: auto; } +#battle_grid #grid_sw { height: auto; } .grid_array { background-repeat: no-repeat } @@ -263,9 +253,13 @@ body.Teutons #plan_actions .russian { display: none } flex-wrap: wrap; justify-content: center; gap: 4px; + margin: 12px; } +.siegeworks:empty { display: none } + #garrison { + background-image: url(images/garrison.svg); background-repeat: no-repeat; background-position: center; display: flex; @@ -275,16 +269,12 @@ body.Teutons #plan_actions .russian { display: none } width: 376px; height: 80px; gap: 2px; + margin: 0 auto; } #garrison.hide { display: none } -.attacker #garrison { background-image: url(images/garrison_attacker.svg); } -.defender #garrison { background-image: url(images/garrison_defender.svg); } - -#garrison .unit { - position: static -} +#garrison .unit { position: static } /* MATS */ @@ -374,7 +364,7 @@ body.Teutons #plan_actions .russian { display: none } z-index: 5; } -.mat .feed_x2 { left: 8px; top: 178px; } +.mat .feed_x2 { left: 8px; top: 164px; } .mat .moved_fought.one { right: 72px; top: 12px; } .mat .moved_fought.two { right: 66px; top: 6px; } @@ -1370,11 +1360,13 @@ body.shift .mustered_vassals {
Battle
-
+
-
+
+
+
@@ -1385,7 +1377,7 @@ body.shift .mustered_vassals {
-
+
diff --git a/play.js b/play.js index 7c3608f..0f973f2 100644 --- a/play.js +++ b/play.js @@ -646,8 +646,12 @@ const ui = { court1: document.getElementById("court1"), court2: document.getElementById("court2"), garrison: document.getElementById("garrison"), - battle_walls1: document.getElementById("battle_walls1"), - battle_walls2: document.getElementById("battle_walls2"), + battle_walls: [ + document.getElementById("battle_walls1"), + document.getElementById("battle_walls2"), + document.getElementById("battle_walls3"), + document.getElementById("battle_walls4"), + ], battle_siegeworks: document.getElementById("grid_sw"), battle_panel: document.getElementById("battle_panel"), battle_header: document.getElementById("battle_header"), @@ -1648,26 +1652,17 @@ function update_battle() { sally_prot = count_siege_markers(view.battle.where) let att_ui, def_ui - - if (view.battle.attacker === "Teutons") { - if (player === "Russians") { - att_ui = ui.battle_walls1 - def_ui = ui.battle_walls2 - } else { - att_ui = ui.battle_walls2 - def_ui = ui.battle_walls1 - } + if (player === view.battle.attacker) { + att_ui = ui.battle_walls[3] + def_ui = ui.battle_walls[2] } else { - if (player === "Russians") { - att_ui = ui.battle_walls2 - def_ui = ui.battle_walls1 - } else { - att_ui = ui.battle_walls1 - def_ui = ui.battle_walls2 - } + att_ui = ui.battle_walls[0] + def_ui = ui.battle_walls[1] } - def_ui.replaceChildren() + for (let i = 0; i < 4; ++i) + ui.battle_walls[i].replaceChildren() + for (let i = 0; i < def_prot; ++i) if (view.battle.attacker === "Teutons") def_ui.appendChild(get_cached_element("marker square russian siege")) @@ -1683,7 +1678,6 @@ function update_battle() { else ui.battle_siegeworks.appendChild(get_cached_element("marker square teutonic siege")) - att_ui.replaceChildren() for (let i = 0; i < att_prot; ++i) if (view.battle.attacker === "Teutons") att_ui.appendChild(get_cached_element("marker square teutonic siege")) -- cgit v1.2.3