Display phase emblems in the middle panel

This patch introduces phase emblems on both sides of the player's name
band in the middle panel. The emblems represent the current phase of
the selected player's civilization: I (Village), II (Town), III (City).
This information is also added to the associated tooltip and is
displayed only to mutual allies and observers.

Fixes #6849
See also: https://wildfiregames.com/forum/topic/107851-introduce-badge-to-indicate-the-phase-6849/
This commit is contained in:
abian 2024-10-10 20:16:34 +02:00 committed by Nicolas Auvray
parent fe16b919fe
commit 42052b69d9
6 changed files with 38 additions and 2 deletions

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c92601e546e03c1c7005191c8b3ee3814d9cac93b5654e61393c95ebec0abfff
size 119

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5a70f0a373d594720c2982fc6253484235fb21f59ed1c5d901d7e88884ccb920
size 1859

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e64d9f57af4b29904500a9bbcf2240b04717ee8eee2bd993a49d0bbab5e5f393
size 120

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0ca2e3c67b17f7d847166a832668a94ce8457aa51d5294a9e9dfb914dbad2baa
size 132

View file

@ -317,9 +317,31 @@ function displaySingle(entState)
});
secondaryObject.hidden = hideSecondary;
let isGaia = playerState.civ == "gaia";
const isGaia = playerState.civ == "gaia";
Engine.GetGUIObjectByName("playerCivIcon").sprite = isGaia ? "" : "cropped:1.0, 0.15625 center:grayscale:" + civEmblem;
Engine.GetGUIObjectByName("civilizationTooltip").tooltip = isGaia ? "" : civName;
if (isGaia)
{
Engine.GetGUIObjectByName("phaseEmblems").sprite = "";
Engine.GetGUIObjectByName("civilizationTooltip").tooltip = "";
}
else
{
let civilizationTooltip = civName;
let civPhaseEmblems = "session/panel_phase_emblems_hidden.png";
// Reveal phases to mutual allies and observers
if (g_ViewedPlayer == -1 || playerState.isMutualAlly[g_ViewedPlayer])
{
const civPhase = g_SimState.players[entState.player].phase
civPhaseEmblems = "session/panel_phase_emblems_" + civPhase + ".png";
const civPhaseData = GetTechnologyData("phase_" + civPhase + "_" + playerState.civ, playerState.civ) ||
GetTechnologyData("phase_" + civPhase, playerState.civ);
civilizationTooltip += " — " + getEntityNames(civPhaseData);
}
Engine.GetGUIObjectByName("phaseEmblems").sprite = "cropped:1.0, 1.0 center:" + civPhaseEmblems;
Engine.GetGUIObjectByName("civilizationTooltip").tooltip = civilizationTooltip;
}
// TODO: we should require all entities to have icons
Engine.GetGUIObjectByName("icon").sprite = template.icon ? ("stretched:session/portraits/" + template.icon) : "BackgroundBlack";

View file

@ -12,6 +12,8 @@
<object size="50%-64 50%-10 50%+64 50%+10" name="playerCivIcon" type="image" ghost="true"/>
<!-- Player color band. -->
<object name="playerColorBackground" type="image" sprite="playerColorBackground" ghost="true"/>
<!-- Phase emblems. -->
<object size="0 0 100% 100%" name="phaseEmblems" type="image" ghost="true"/>
<object type="image" sprite="bottomEdgedPanelShader" ghost="true"/>
<!-- Player name. -->
<object size="0 50%-10 100% 50%+10" name="player" type="text" style="largeCenteredOutlinedText"/>