Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/tooltips.js
Show First 20 Lines • Show All 840 Lines • ▼ Show 20 Lines | "details": sprintf(translate("%(resources)s / %(time)s"), { | ||||
"rate": template.resourceTrickle.rates[res] | "rate": template.resourceTrickle.rates[res] | ||||
}) | }) | ||||
).join(" "), | ).join(" "), | ||||
"time": getSecondsString(template.resourceTrickle.interval / 1000) | "time": getSecondsString(template.resourceTrickle.interval / 1000) | ||||
}) | }) | ||||
}); | }); | ||||
} | } | ||||
function getUpkeepTooltip(template) | |||||
{ | |||||
if (!template.upkeep) | |||||
return ""; | |||||
let resCodes = g_ResourceData.GetCodes().filter(res => !!template.upkeep.rates[res]); | |||||
if (!resCodes.length) | |||||
return ""; | |||||
return sprintf(translate("%(label)s %(details)s"), { | |||||
"label": headerFont(translate("Upkeep:")), | |||||
"details": sprintf(translate("%(resources)s / %(time)s"), { | |||||
"resources": | |||||
resCodes.map( | |||||
res => sprintf(translate("%(resourceIcon)s %(rate)s"), { | |||||
"resourceIcon": resourceIcon(res), | |||||
"rate": template.upkeep.rates[res] | |||||
}) | |||||
).join(" "), | |||||
"time": getSecondsString(template.upkeep.interval / 1000) | |||||
}) | |||||
}); | |||||
} | |||||
/** | /** | ||||
* Returns an array of strings for a set of wall pieces. If the pieces share | * Returns an array of strings for a set of wall pieces. If the pieces share | ||||
* resource type requirements, output will be of the form '10 to 30 Stone', | * resource type requirements, output will be of the form '10 to 30 Stone', | ||||
* otherwise output will be, e.g. '10 Stone, 20 Stone, 30 Stone'. | * otherwise output will be, e.g. '10 Stone, 20 Stone, 30 Stone'. | ||||
*/ | */ | ||||
function getWallPieceTooltip(wallTypes) | function getWallPieceTooltip(wallTypes) | ||||
{ | { | ||||
let out = []; | let out = []; | ||||
▲ Show 20 Lines • Show All 332 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator