Harmonized design between civinfo and structree

This commit is contained in:
Sanctorum Thomas 2025-02-10 02:26:49 +01:00 committed by Ralph Sennhauser
parent 026a668a0f
commit 37065ebc71
12 changed files with 49 additions and 92 deletions

View file

@ -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);
}
/**

View file

@ -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");

View file

@ -1,16 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<object size="25 50 100%-25 65%-5">
<object type="image" sprite="TranslucentPanelThinBorder" size="0 5 100% 40">
<object
name="civGameplayHeading"
type="text"
font="sans-bold-16"
textcolor="white"
text_align="left"
text_valign="center"
size="10 0 100% 100%"
/>
</object>
<object size="25 135 100%-25 100%-66">
<include file="gui/reference/civinfo/Sections/Subsections/BonusesSubsection.xml"/>

View file

@ -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");

View file

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<object size="25 65% 100%-25 100%-56">
<object type="image" sprite="TranslucentPanelThinBorder" size="0 0 100% 35">
<object
name="civHistoryHeading"
type="text"
font="sans-bold-16"
textcolor="white"
text_align="left"
text_valign="center"
size="10 0 100% 100%"
/>
</object>
<object type="image" sprite="ModernDarkBoxGold" size="0 35 100% 100%-12">
<object
name="civHistoryText"
type="text"
font="sans-14"
scrollbar="true"
scrollbar_style="ModernScrollBar"
textcolor="white"
text_align="left"
size="10 0 100% 100%"
/>
</object>
</object>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<object type="image" sprite="ModernDarkBoxGold" size="1% 45 33% 100%">
<object type="image" sprite="ModernDarkBoxGold" size="1% 0 33% 100%">
<object
name="civBonuses"
type="text"

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<object type="image" sprite="ModernDarkBoxGold" size="67% 45 99% 60%-5">
<object type="image" sprite="ModernDarkBoxGold" size="67% 0 99% 60%-5">
<object
name="civStructures"
type="text"

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<object type="image" sprite="ModernDarkBoxGold" size="34% 45 66% 100%">
<object type="image" sprite="ModernDarkBoxGold" size="34% 0 66% 100%">
<object
name="civTechs"
type="text"

View file

@ -24,12 +24,38 @@
<!-- Civ selection -->
<include file="gui/reference/common/Dropdowns/CivSelectDropdown.xml"/>
<object
name="civEmblem"
type="image"
size="16 24 112 120"
sprite="stretched:pregame/shell/logo/wfg_logo_white.png"
/>
<object
name="civName"
type="text"
font="sans-bold-20"
textcolor="white"
text_align="left"
text_valign="top"
size="114 32 100%-8 96"
/>
<object
name="civHistory"
type="text"
font="sans-12"
textcolor="white"
text_align="left"
text_valign="top"
size="114 52 100%-16 132"
scrollbar="true"
scrollbar_style="ModernScrollBar"
/>
<!-- Civ gameplay data display -->
<include file="gui/reference/civinfo/Sections/GameplaySection.xml"/>
<!-- Civ history display -->
<include file="gui/reference/civinfo/Sections/HistorySection.xml"/>
<!-- Buttons -->
<include file="gui/reference/common/Buttons/StructreeButton.xml"/>
<include file="gui/reference/common/Buttons/CloseButton.xml"/>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<object size="0 140 100%-16 100%-66" name="treeSection">
<object size="0 135 100%-16 100%-66" name="treeSection">
<object name="phaseIdents">
<repeat count="4" var="n">
<object name="phase[n]_ident" hidden="true">

View file

@ -26,7 +26,7 @@
<object
name="civEmblem"
type="image"
size="16 24 112 112"
size="16 24 112 120"
sprite="stretched:pregame/shell/logo/wfg_logo_white.png"
/>

View file

@ -6,7 +6,7 @@
<Identity>
<Civ>kush</Civ>
<GenericName>Kushites</GenericName>
<History>The Kingdom of Kush was an ancient African kingdom situated on the confluences of the Blue Nile, White Nile and River Atbara in what is now the Republic of Sudan. The Kushite era of rule in the region was established after the Bronze Age collapse of the New Kingdom of Egypt, and it was centered at Napata in its early phase. They invaded Egypt in the 8th century BC, and the Kushite emperors ruled as Pharaohs of the Twenty-fifth dynasty of Egypt for a century, until they were expelled by the Assyrians. Kushite culture was influenced heavily by the Egyptians, with Kushite pyramid building and monumental temple architecture still extent. The Kushites even worshipped many Egyptian gods, including Amun. During Classical antiquity, the Kushite imperial capital was at Meroe. In early Greek geography, the Meroitic kingdom was known as Aethiopia. The Kushite kingdom persisted until the 4th century AD, when it weakened and disintegrated due to internal rebellion, eventually succumbing to the rising power of Axum.</History>
<History>The Kingdom of Kush was an African kingdom located at the confluences of the Blue Nile, White Nile, and River Atbara, in present-day Sudan. It rose following the collapse of Egypt's New Kingdom, with its early capital at Napata. In the 8th century BC, the Kushites invaded Egypt and established the Twenty-fifth dynasty, ruling as Pharaohs until expelled by the Assyrians. The capital moved to Meroe, the center of the Meroitic kingdom known as Aethiopia in Greek geography. Weakened due to internal rebellion, The kingdom lasted until the 4th century AD and was overtaken by the Kingdom of Axum. Influenced by Egyptian culture, the Kushites built throughout their reign pyramids and temples and worshipped gods like Amun.</History>
<Icon>emblems/emblem_kushites.png</Icon>
</Identity>
<Player>