From 37065ebc71bf105ba3e9cc05665f5979fc99ae1f Mon Sep 17 00:00:00 2001 From: Sanctorum Thomas Date: Mon, 10 Feb 2025 02:26:49 +0100 Subject: [PATCH] Harmonized design between civinfo and structree --- .../gui/reference/civinfo/CivInfoPage.js | 15 +++++++-- .../civinfo/Sections/GameplaySection.js | 10 ------ .../civinfo/Sections/GameplaySection.xml | 13 +------- .../civinfo/Sections/HistorySection.js | 30 ----------------- .../civinfo/Sections/HistorySection.xml | 29 ----------------- .../Subsections/BonusesSubsection.xml | 2 +- .../Subsections/StructuresSubsection.xml | 2 +- .../Subsections/TechnologiesSubsection.xml | 2 +- .../public/gui/reference/civinfo/civinfo.xml | 32 +++++++++++++++++-- .../structree/Sections/Tree/TreeSection.xml | 2 +- .../gui/reference/structree/structree.xml | 2 +- .../templates/special/players/kush.xml | 2 +- 12 files changed, 49 insertions(+), 92 deletions(-) delete mode 100644 binaries/data/mods/public/gui/reference/civinfo/Sections/HistorySection.js delete mode 100644 binaries/data/mods/public/gui/reference/civinfo/Sections/HistorySection.xml diff --git a/binaries/data/mods/public/gui/reference/civinfo/CivInfoPage.js b/binaries/data/mods/public/gui/reference/civinfo/CivInfoPage.js index 890b1935f8..1ee7f099ba 100644 --- a/binaries/data/mods/public/gui/reference/civinfo/CivInfoPage.js +++ b/binaries/data/mods/public/gui/reference/civinfo/CivInfoPage.js @@ -5,10 +5,18 @@ class CivInfoPage extends ReferencePage super(); this.civSelection = new CivSelectDropdown(this.civData); + if (!this.civSelection.hasCivs()) + { + this.closePage(); + return; + } this.civSelection.registerHandler(this.selectCiv.bind(this)); + this.CivEmblem = Engine.GetGUIObjectByName("civEmblem"); + this.CivName = Engine.GetGUIObjectByName("civName"); + this.CivHistory = Engine.GetGUIObjectByName("civHistory"); + this.gameplaySection = new GameplaySection(this); - this.historySection = new HistorySection(this); let structreeButton = new StructreeButton(this); let closeButton = new CloseButton(this); @@ -44,13 +52,16 @@ class CivInfoPage extends ReferencePage { this.setActiveCiv(civCode); + this.CivEmblem.sprite = "stretched:" + this.civData[this.activeCiv].Emblem; + this.CivName.caption = this.civData[this.activeCiv].Name; + this.CivHistory.caption = this.civData[this.activeCiv].History || ""; + let civInfo = this.civData[civCode]; if(!civInfo) error(sprintf("Error loading civ data for \"%(code)s\"", { "code": civCode })); this.gameplaySection.update(this.activeCiv, civInfo); - this.historySection.update(civInfo); } /** diff --git a/binaries/data/mods/public/gui/reference/civinfo/Sections/GameplaySection.js b/binaries/data/mods/public/gui/reference/civinfo/Sections/GameplaySection.js index 63316917b0..70f60ef2d8 100644 --- a/binaries/data/mods/public/gui/reference/civinfo/Sections/GameplaySection.js +++ b/binaries/data/mods/public/gui/reference/civinfo/Sections/GameplaySection.js @@ -3,7 +3,6 @@ class GameplaySection constructor(page) { this.page = page; - this.CivGameplayHeading = Engine.GetGUIObjectByName('civGameplayHeading'); this.BonusesSubsection = new BonusesSubsection(this.page); this.HeroesSubsection = new HeroesSubsection(this.page); @@ -13,18 +12,9 @@ class GameplaySection update(civCode, civInfo) { - this.CivGameplayHeading.caption = - this.page.formatHeading( - sprintf(this.headingCaption, { "civilization": civInfo.Name }), - this.page.SectionHeaderSize - ); - this.BonusesSubsection.update(civCode, civInfo); this.TechnologiesSubsection.update(civCode); this.StructuresSubsection.update(civCode); this.HeroesSubsection.update(civCode); } } - -GameplaySection.prototype.headingCaption = - translate("%(civilization)s Gameplay"); diff --git a/binaries/data/mods/public/gui/reference/civinfo/Sections/GameplaySection.xml b/binaries/data/mods/public/gui/reference/civinfo/Sections/GameplaySection.xml index 40000aa164..9097bb4ef3 100644 --- a/binaries/data/mods/public/gui/reference/civinfo/Sections/GameplaySection.xml +++ b/binaries/data/mods/public/gui/reference/civinfo/Sections/GameplaySection.xml @@ -1,16 +1,5 @@ - - - - + diff --git a/binaries/data/mods/public/gui/reference/civinfo/Sections/HistorySection.js b/binaries/data/mods/public/gui/reference/civinfo/Sections/HistorySection.js deleted file mode 100644 index 5e9abdcec2..0000000000 --- a/binaries/data/mods/public/gui/reference/civinfo/Sections/HistorySection.js +++ /dev/null @@ -1,30 +0,0 @@ -class HistorySection -{ - constructor(page) - { - this.page = page; - this.CivHistoryHeading = Engine.GetGUIObjectByName('civHistoryHeading'); - this.CivHistoryText = Engine.GetGUIObjectByName('civHistoryText'); - } - - update(civInfo) - { - if (!civInfo.History) - { - this.CivHistoryHeading.caption = ""; - this.CivHistoryText.caption = ""; - return; - } - - this.CivHistoryHeading.caption = - this.page.formatHeading( - sprintf(this.headingCaption, { "civilization": civInfo.Name }), - this.page.SectionHeaderSize - ); - - this.CivHistoryText.caption = civInfo.History; - } -} - -HistorySection.prototype.headingCaption = - translate("History of the %(civilization)s"); diff --git a/binaries/data/mods/public/gui/reference/civinfo/Sections/HistorySection.xml b/binaries/data/mods/public/gui/reference/civinfo/Sections/HistorySection.xml deleted file mode 100644 index 17b13772ed..0000000000 --- a/binaries/data/mods/public/gui/reference/civinfo/Sections/HistorySection.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - diff --git a/binaries/data/mods/public/gui/reference/civinfo/Sections/Subsections/BonusesSubsection.xml b/binaries/data/mods/public/gui/reference/civinfo/Sections/Subsections/BonusesSubsection.xml index 8bac15932a..ce878ae30d 100644 --- a/binaries/data/mods/public/gui/reference/civinfo/Sections/Subsections/BonusesSubsection.xml +++ b/binaries/data/mods/public/gui/reference/civinfo/Sections/Subsections/BonusesSubsection.xml @@ -1,5 +1,5 @@ - + - + - + + + + + + + - - - diff --git a/binaries/data/mods/public/gui/reference/structree/Sections/Tree/TreeSection.xml b/binaries/data/mods/public/gui/reference/structree/Sections/Tree/TreeSection.xml index 58d5fa5f8d..ea3d6d6a33 100644 --- a/binaries/data/mods/public/gui/reference/structree/Sections/Tree/TreeSection.xml +++ b/binaries/data/mods/public/gui/reference/structree/Sections/Tree/TreeSection.xml @@ -1,5 +1,5 @@ - +