From 7125e72e52bc0ff26381801fc655b92b3475db7f Mon Sep 17 00:00:00 2001 From: leper Date: Sun, 11 Nov 2012 23:08:44 +0000 Subject: [PATCH] Add build/research/train time to tooltips. This was SVN commit r12848. --- binaries/data/mods/public/gui/session/setup.xml | 4 ++++ .../mods/public/gui/session/utility_functions.js | 14 ++++++++------ .../public/simulation/components/GuiInterface.js | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/binaries/data/mods/public/gui/session/setup.xml b/binaries/data/mods/public/gui/session/setup.xml index 10b7d3b38b..ffc9c4d0f8 100644 --- a/binaries/data/mods/public/gui/session/setup.xml +++ b/binaries/data/mods/public/gui/session/setup.xml @@ -22,4 +22,8 @@ sprite="stretched:session/icons/resources/wood_small.png" size="16 16" /> + diff --git a/binaries/data/mods/public/gui/session/utility_functions.js b/binaries/data/mods/public/gui/session/utility_functions.js index 4e3c8dab28..781c0cd261 100644 --- a/binaries/data/mods/public/gui/session/utility_functions.js +++ b/binaries/data/mods/public/gui/session/utility_functions.js @@ -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; } diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js index d436fa808f..84dd145690 100644 --- a/binaries/data/mods/public/simulation/components/GuiInterface.js +++ b/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -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;