Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/tooltips.js
Show First 20 Lines • Show All 588 Lines • ▼ Show 20 Lines | "details": | ||||
type => sprintf(translate("%(resourceIcon)s %(rate)s"), { | type => sprintf(translate("%(resourceIcon)s %(rate)s"), { | ||||
"resourceIcon": resourceIcon(type), | "resourceIcon": resourceIcon(type), | ||||
"rate": rates[type] | "rate": rates[type] | ||||
}) | }) | ||||
).join(" ") | ).join(" ") | ||||
}); | }); | ||||
} | } | ||||
/** | |||||
* Returns the resources this entity supplies in the specified entity's tooltip | |||||
*/ | |||||
function getResourceSupplyTooltip(template) | |||||
{ | |||||
if (!template.supply) | |||||
return ""; | |||||
let supply = template.supply; | |||||
let type = supply.type[0] == "treasure" ? supply.type[1] : supply.type[0]; | |||||
// Translation: Label in tooltip showing the resource type and quantity of a given resource supply. | |||||
return sprintf(translate("%(label)s %(component)s %(amount)s"), { | |||||
"label": headerFont(translate("Resource Supply:")), | |||||
"component": resourceIcon(type), | |||||
// Translation: Marks that a resource supply entity has an unending, infinite, supply of its resource. | |||||
"amount": Number.isFinite(+supply.amount) ? supply.amount : translate("∞") | |||||
}); | |||||
} | |||||
function getResourceTrickleTooltip(template) | function getResourceTrickleTooltip(template) | ||||
{ | { | ||||
if (!template.resourceTrickle) | if (!template.resourceTrickle) | ||||
return ""; | return ""; | ||||
let resCodes = g_ResourceData.GetCodes().filter(res => !!template.resourceTrickle.rates[res]); | let resCodes = g_ResourceData.GetCodes().filter(res => !!template.resourceTrickle.rates[res]); | ||||
if (!resCodes.length) | if (!resCodes.length) | ||||
return ""; | return ""; | ||||
▲ Show 20 Lines • Show All 316 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator