forked from 0ad/0ad
Improve disabled technology tooltip. Fixes #2497
This was SVN commit r15055.
This commit is contained in:
parent
a49b359748
commit
b8245da606
@ -715,6 +715,15 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, playerState, items, c
|
||||
{
|
||||
button.enabled = false;
|
||||
button.tooltip += "\n" + GetTechnologyData(entType).requirementsTooltip;
|
||||
if (GetTechnologyData(entType).classRequirements)
|
||||
{
|
||||
var player = Engine.GetPlayerID();
|
||||
var current = GetSimState().players[player].classCounts[GetTechnologyData(entType).classRequirements.class];
|
||||
// If current is undefined, this means no building filling the requirement has been found
|
||||
current = current ? current : 0;
|
||||
var remaining = GetTechnologyData(entType).classRequirements.number - current;
|
||||
button.tooltip += " " + sprintf(translatePlural("Remaining: %(number)s to build.", "Remaining: %(number)s to build.", remaining), { number: remaining});
|
||||
}
|
||||
grayscale = "grayscale:";
|
||||
affordableMask.hidden = false;
|
||||
affordableMask.sprite = "colour: 0 0 0 127";
|
||||
|
@ -712,6 +712,9 @@ GuiInterface.prototype.GetTechnologyData = function(player, name)
|
||||
else
|
||||
ret.requirementsTooltip = "";
|
||||
|
||||
if (template.requirements.class)
|
||||
ret.classRequirements = {"class": template.requirements.class, "number": template.requirements.number};
|
||||
|
||||
ret.description = template.description;
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user