forked from 0ad/0ad
Fix resource label when type is a treasure and fix civ tooltip
This was SVN commit r11960.
This commit is contained in:
parent
aa58b6ccfa
commit
bf81922c62
@ -88,23 +88,22 @@ function displaySingle(entState, template)
|
|||||||
if (entState.resourceSupply)
|
if (entState.resourceSupply)
|
||||||
{
|
{
|
||||||
var resources = Math.ceil(+entState.resourceSupply.amount) + "/" + entState.resourceSupply.max;
|
var resources = Math.ceil(+entState.resourceSupply.amount) + "/" + entState.resourceSupply.max;
|
||||||
var resourceType = (resourceType == "treasure")? entState.resourceSupply.type["specific"]
|
var resourceType = entState.resourceSupply.type["generic"];
|
||||||
: entState.resourceSupply.type["generic"];
|
if (resourceType == "treasure")
|
||||||
|
resourceType = entState.resourceSupply.type["specific"];
|
||||||
|
|
||||||
var unitResourceBar = getGUIObjectByName("resourceBar");
|
var unitResourceBar = getGUIObjectByName("resourceBar");
|
||||||
var resourceSize = unitResourceBar.size;
|
var resourceSize = unitResourceBar.size;
|
||||||
|
|
||||||
resourceSize.rright = 100 * Math.max(0, Math.min(1, +entState.resourceSupply.amount / +entState.resourceSupply.max));
|
resourceSize.rright = 100 * Math.max(0, Math.min(1, +entState.resourceSupply.amount / +entState.resourceSupply.max));
|
||||||
unitResourceBar.size = resourceSize;
|
unitResourceBar.size = resourceSize;
|
||||||
|
|
||||||
var unitResources = getGUIObjectByName("resources");
|
|
||||||
unitResources.tooltip = resourceType;
|
|
||||||
|
|
||||||
getGUIObjectByName("resourceLabel").caption = toTitleCase(resourceType) + ":";
|
getGUIObjectByName("resourceLabel").caption = toTitleCase(resourceType) + ":";
|
||||||
getGUIObjectByName("resourceStats").caption = resources;
|
getGUIObjectByName("resourceStats").caption = resources;
|
||||||
|
|
||||||
getGUIObjectByName("resourceSection").size = (!entState.hitpoints)? getGUIObjectByName("healthSection").size
|
if (entState.hitpoints)
|
||||||
: getGUIObjectByName("staminaSection").size;
|
getGUIObjectByName("resourceSection").size = getGUIObjectByName("staminaSection").size;
|
||||||
|
else
|
||||||
|
getGUIObjectByName("resourceSection").size = getGUIObjectByName("healthSection").size;
|
||||||
|
|
||||||
getGUIObjectByName("resourceSection").hidden = false;
|
getGUIObjectByName("resourceSection").hidden = false;
|
||||||
}
|
}
|
||||||
@ -143,7 +142,7 @@ function displaySingle(entState, template)
|
|||||||
getGUIObjectByName("generic").caption = genericName;
|
getGUIObjectByName("generic").caption = genericName;
|
||||||
getGUIObjectByName("player").caption = playerName;
|
getGUIObjectByName("player").caption = playerName;
|
||||||
getGUIObjectByName("playerColorBackground").sprite = "colour: " + playerColor;
|
getGUIObjectByName("playerColorBackground").sprite = "colour: " + playerColor;
|
||||||
getGUIObjectByName("player").tooltip = civName;
|
getGUIObjectByName("playerColorBackground").tooltip = civName;
|
||||||
|
|
||||||
// TODO: Set this to the current player, not the selected unit's player
|
// TODO: Set this to the current player, not the selected unit's player
|
||||||
//getGUIObjectByName("civIcon").tooltip = civName;
|
//getGUIObjectByName("civIcon").tooltip = civName;
|
||||||
|
@ -691,15 +691,15 @@
|
|||||||
<object size="100%-32 0 100%+4 36" type="image" name="resourceCarryingIcon"/>
|
<object size="100%-32 0 100%+4 36" type="image" name="resourceCarryingIcon"/>
|
||||||
|
|
||||||
<!-- Specific Name -->
|
<!-- Specific Name -->
|
||||||
<object size="0 0 100% 36" name="specific" type="text" style="SecondaryLabelTextLeft" tooltip_style="sessionToolTipBold"/>
|
<object size="0 0 100% 36" name="specific" type="text" style="SecondaryLabelTextLeft"/>
|
||||||
|
|
||||||
<!-- Generic Name -->
|
<!-- Generic Name -->
|
||||||
<object size="0 100%-46 100% 100%-26" type="image" sprite="detailsShader" ghost="true"/>
|
<object size="0 100%-46 100% 100%-26" type="image" sprite="detailsShader" ghost="true"/>
|
||||||
<object size="0 100%-48 100% 100%-26" name="generic" type="text" style="StatsLabelTextLeft" tooltip_style="sessionToolTipBold"/>
|
<object size="0 100%-48 100% 100%-26" name="generic" type="text" style="StatsLabelTextLeft"/>
|
||||||
|
|
||||||
<!-- Player Name -->
|
<!-- Player Name -->
|
||||||
<object size="2 100%-26 100%-1 100%" name="playerColorBackground" type="image" sprite="playerColorBackground">
|
<object size="2 100%-26 100%-1 100%" name="playerColorBackground" type="image" sprite="playerColorBackground" tooltip_style="sessionToolTip">
|
||||||
<object size="0 0 100% 100%" name="player" type="text" style="PrimaryLabelTextCentered" tooltip_style="sessionToolTipBold"/>
|
<object size="0 0 100% 100%" name="player" type="text" style="PrimaryLabelTextCentered"/>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user