Show the number of builders together with build time.
Also adds the remaining time to the tooltip. Differential revision: D2425 Reviewed by: @bb This was SVN commit r24452.
This commit is contained in:
parent
6a3cad75eb
commit
7f6602cffd
@ -594,46 +594,70 @@ function getProjectilesTooltip(template)
|
||||
|
||||
function getRepairTimeTooltip(entState)
|
||||
{
|
||||
return sprintf(translate("%(label)s %(details)s"), {
|
||||
let result = [];
|
||||
result.push(sprintf(translate("%(label)s %(details)s"), {
|
||||
"label": headerFont(translate("Number of repairers:")),
|
||||
"details": entState.repairable.numBuilders
|
||||
}) + "\n" + (entState.repairable.numBuilders ?
|
||||
sprintf(translatePlural(
|
||||
}));
|
||||
if (entState.repairable.numBuilders)
|
||||
{
|
||||
result.push(sprintf(translate("%(label)s %(details)s"), {
|
||||
"label": headerFont(translate("Remaining repair time:")),
|
||||
"details": getSecondsString(Math.floor(entState.repairable.buildTime.timeRemaining))
|
||||
}));
|
||||
let timeReduction = Math.round(entState.repairable.buildTime.timeRemaining - entState.repairable.buildTime.timeRemainingNew);
|
||||
result.push(sprintf(translatePlural(
|
||||
"Add another worker to speed up the repairs by %(second)s second.",
|
||||
"Add another worker to speed up the repairs by %(second)s seconds.",
|
||||
Math.round(entState.repairable.buildTime.timeRemaining - entState.repairable.buildTime.timeRemainingNew)),
|
||||
timeReduction),
|
||||
{
|
||||
"second": Math.round(entState.repairable.buildTime.timeRemaining - entState.repairable.buildTime.timeRemainingNew)
|
||||
}) :
|
||||
sprintf(translatePlural(
|
||||
"second": timeReduction
|
||||
}));
|
||||
}
|
||||
else
|
||||
result.push(sprintf(translatePlural(
|
||||
"Add a worker to finish the repairs in %(second)s second.",
|
||||
"Add a worker to finish the repairs in %(second)s seconds.",
|
||||
Math.round(entState.repairable.buildTime.timeRemainingNew)),
|
||||
{
|
||||
"second": Math.round(entState.repairable.buildTime.timeRemainingNew)
|
||||
}));
|
||||
|
||||
return result.join("\n");
|
||||
}
|
||||
|
||||
function getBuildTimeTooltip(entState)
|
||||
{
|
||||
return sprintf(translate("%(label)s %(details)s"), {
|
||||
let result = [];
|
||||
result.push(sprintf(translate("%(label)s %(details)s"), {
|
||||
"label": headerFont(translate("Number of builders:")),
|
||||
"details": entState.foundation.numBuilders
|
||||
}) + "\n" + (entState.foundation.numBuilders ?
|
||||
sprintf(translatePlural(
|
||||
}));
|
||||
if (entState.foundation.numBuilders)
|
||||
{
|
||||
result.push(sprintf(translate("%(label)s %(details)s"), {
|
||||
"label": headerFont(translate("Remaining build time:")),
|
||||
"details": getSecondsString(Math.floor(entState.foundation.buildTime.timeRemaining))
|
||||
}));
|
||||
let timeReduction = Math.round(entState.foundation.buildTime.timeRemaining - entState.foundation.buildTime.timeRemainingNew);
|
||||
result.push(sprintf(translatePlural(
|
||||
"Add another worker to speed up the construction by %(second)s second.",
|
||||
"Add another worker to speed up the construction by %(second)s seconds.",
|
||||
Math.round(entState.foundation.buildTime.timeRemaining - entState.foundation.buildTime.timeRemainingNew)),
|
||||
timeReduction),
|
||||
{
|
||||
"second": Math.round(entState.foundation.buildTime.timeRemaining - entState.foundation.buildTime.timeRemainingNew)
|
||||
}) :
|
||||
sprintf(translatePlural(
|
||||
"second": timeReduction
|
||||
}));
|
||||
}
|
||||
else
|
||||
result.push(sprintf(translatePlural(
|
||||
"Add a worker to finish the construction in %(second)s second.",
|
||||
"Add a worker to finish the construction in %(second)s seconds.",
|
||||
Math.round(entState.foundation.buildTime.timeRemainingNew)),
|
||||
{
|
||||
"second": Math.round(entState.foundation.buildTime.timeRemainingNew)
|
||||
}));
|
||||
|
||||
return result.join("\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,8 +267,10 @@ function displaySingle(entState)
|
||||
{
|
||||
resourceCarryingIcon.sprite = "stretched:session/icons/repair.png";
|
||||
resourceCarryingIcon.tooltip = getBuildTimeTooltip(entState);
|
||||
resourceCarryingText.caption = entState.foundation.numBuilders ?
|
||||
Engine.FormatMillisecondsIntoDateStringGMT(entState.foundation.buildTime.timeRemaining * 1000, translateWithContext("countdown format", "m:ss")) : "";
|
||||
resourceCarryingText.caption = entState.foundation.numBuilders ? sprintf(translate("(%(number)s)\n%(time)s"), {
|
||||
"number": entState.foundation.numBuilders,
|
||||
"time": Engine.FormatMillisecondsIntoDateStringGMT(entState.foundation.buildTime.timeRemaining * 1000, translateWithContext("countdown format", "m:ss"))
|
||||
}) : "";
|
||||
}
|
||||
else if (entState.resourceSupply && (!entState.resourceSupply.killBeforeGather || !entState.hitpoints))
|
||||
{
|
||||
@ -283,8 +285,10 @@ function displaySingle(entState)
|
||||
{
|
||||
resourceCarryingIcon.sprite = "stretched:session/icons/repair.png";
|
||||
resourceCarryingIcon.tooltip = getRepairTimeTooltip(entState);
|
||||
resourceCarryingText.caption = entState.repairable.numBuilders ?
|
||||
Engine.FormatMillisecondsIntoDateStringGMT(entState.repairable.buildTime.timeRemaining * 1000, translateWithContext("countdown format", "m:ss")) : "";
|
||||
resourceCarryingText.caption = entState.repairable.numBuilders ? sprintf(translate("(%(number)s)\n%(time)s"), {
|
||||
"number": entState.repairable.numBuilders,
|
||||
"time": Engine.FormatMillisecondsIntoDateStringGMT(entState.repairable.buildTime.timeRemaining * 1000, translateWithContext("countdown format", "m:ss"))
|
||||
}) : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user