mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-27 11:53:41 +00:00
Center generic/specific name if just one is given and hide the other
Patch By: LangBart Comments By: Freagarach Differential Revision: D4290 fixes #6341 This was SVN commit r25964.
This commit is contained in:
@@ -301,11 +301,20 @@ function displaySingle(entState)
|
||||
Engine.GetGUIObjectByName("playerColorBackground").sprite =
|
||||
"color:" + g_DiplomacyColors.getPlayerColor(entState.player, 128);
|
||||
|
||||
Engine.GetGUIObjectByName("primary").caption = primaryName;
|
||||
Engine.GetGUIObjectByName("secondary").caption = !secondaryName || primaryName == secondaryName ? "" :
|
||||
const hideSecondary = !secondaryName || primaryName == secondaryName;
|
||||
|
||||
const primaryObject = Engine.GetGUIObjectByName("primary");
|
||||
primaryObject.caption = primaryName;
|
||||
const primaryObjectSize = primaryObject.size;
|
||||
primaryObjectSize.rbottom = hideSecondary ? 100 : 50;
|
||||
primaryObject.size = primaryObjectSize;
|
||||
|
||||
const secondaryObject = Engine.GetGUIObjectByName("secondary");
|
||||
secondaryObject.caption = hideSecondary ? "" :
|
||||
sprintf(translate("(%(secondaryName)s)"), {
|
||||
"secondaryName": secondaryName
|
||||
});
|
||||
secondaryObject.hidden = hideSecondary;
|
||||
|
||||
let isGaia = playerState.civ == "gaia";
|
||||
Engine.GetGUIObjectByName("playerCivIcon").sprite = isGaia ? "" : "cropped:1.0, 0.15625 center:grayscale:" + civEmblem;
|
||||
|
||||
+3
-3
@@ -18,9 +18,9 @@
|
||||
</object>
|
||||
|
||||
<!-- Primary and secondary names. -->
|
||||
<object>
|
||||
<object size="0 2 100% 22" name="primary" ghost="true" type="text" style="PrimaryNameCentered"/>
|
||||
<object size="0 17 100% 37" name="secondary" ghost="true" type="text" style="SecondaryNameCentered"/>
|
||||
<object size="0 3 100% 37">
|
||||
<object size="0 0 100% 50%" name="primary" ghost="true" type="text" style="PrimaryNameCentered"/>
|
||||
<object size="0 50%-1 100% 100%" name="secondary" ghost="true" type="text" style="SecondaryNameCentered"/>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user