1
0
forked from 0ad/0ad

Add build/research/train time to tooltips.

This was SVN commit r12848.
This commit is contained in:
leper 2012-11-11 23:08:44 +00:00
parent fe45a2b046
commit 7125e72e52
3 changed files with 14 additions and 6 deletions

View File

@ -22,4 +22,8 @@
sprite="stretched:session/icons/resources/wood_small.png"
size="16 16"
/>
<icon name="iconTime"
sprite="stretched:session/icons/resources/time_small.png"
size="16 16"
/>
</setup>

View File

@ -8,7 +8,8 @@ const COST_DISPLAY_NAMES = {
"wood": "[icon=\"iconWood\"]",
"stone": "[icon=\"iconStone\"]",
"metal": "[icon=\"iconMetal\"]",
"population": "[icon=\"iconPopulation\"]"
"population": "[icon=\"iconPopulation\"]",
"time": "[icon=\"iconTime\"]"
};
//-------------------------------- -------------------------------- --------------------------------
@ -264,11 +265,12 @@ function getCostComponentDisplayName(costComponentName)
function getEntityCostComponentsTooltipString(template)
{
var costs = [];
if (template.cost.food) costs.push("[font=\"serif-12\"]" + getCostComponentDisplayName("food") + "[/font] " + template.cost.food);
if (template.cost.wood) costs.push("[font=\"serif-12\"]" + getCostComponentDisplayName("wood") + "[/font] " + template.cost.wood);
if (template.cost.metal) costs.push("[font=\"serif-12\"]" + getCostComponentDisplayName("metal") + "[/font] " + template.cost.metal);
if (template.cost.stone) costs.push("[font=\"serif-12\"]" + getCostComponentDisplayName("stone") + "[/font] " + template.cost.stone);
if (template.cost.population) costs.push("[font=\"serif-12\"]" + getCostComponentDisplayName("population") + "[/font] " + template.cost.population);
if (template.cost.food) costs.push(getCostComponentDisplayName("food") + " " + template.cost.food);
if (template.cost.wood) costs.push(getCostComponentDisplayName("wood") + " " + template.cost.wood);
if (template.cost.metal) costs.push(getCostComponentDisplayName("metal") + " " + template.cost.metal);
if (template.cost.stone) costs.push(getCostComponentDisplayName("stone") + " " + template.cost.stone);
if (template.cost.population) costs.push(getCostComponentDisplayName("population") + " " + template.cost.population);
if (template.cost.time) costs.push(getCostComponentDisplayName("time") + " " + template.cost.time);
return costs;
}

View File

@ -401,6 +401,7 @@ GuiInterface.prototype.GetTemplateData = function(player, name)
if (template.Cost.Resources.metal) ret.cost.metal = GetTechModifiedProperty(techMods, template, "Cost/Resources/metal", +template.Cost.Resources.metal);
if (template.Cost.Population) ret.cost.population = GetTechModifiedProperty(techMods, template, "Cost/Population", +template.Cost.Population);
if (template.Cost.PopulationBonus) ret.cost.populationBonus = GetTechModifiedProperty(techMods, template, "Cost/PopulationBonus", +template.Cost.PopulationBonus);
if (template.Cost.BuildTime) ret.cost.time = GetTechModifiedProperty(techMods, template, "Cost/BuildTime", +template.Cost.BuildTime);
}
if (template.Footprint)
@ -531,6 +532,7 @@ GuiInterface.prototype.GetTechnologyData = function(player, name)
"wood": template.cost ? (+template.cost.wood) : 0,
"metal": template.cost ? (+template.cost.metal) : 0,
"stone": template.cost ? (+template.cost.stone) : 0,
"time": template.researchTime ? (+template.researchTime) : 0,
}
ret.tooltip = template.tooltip;