Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/selection_panels.js
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
}); | }); | ||||
data.button.onPress = function() { | data.button.onPress = function() { | ||||
performFormation(data.unitEntStates.map(state => state.id), data.item); | performFormation(data.unitEntStates.map(state => state.id), data.item); | ||||
}; | }; | ||||
let tooltip = translate(formationInfo.name); | let tooltip = translate(formationInfo.name); | ||||
if (!formationOk && formationInfo.tooltip) | if (!formationOk && formationInfo.tooltip) | ||||
tooltip += "\n" + coloredText(translate(formationInfo.tooltip), "red"); | tooltip += "\n" + setColor(translate(formationInfo.tooltip), "red"); | ||||
data.button.tooltip = tooltip; | data.button.tooltip = tooltip; | ||||
data.button.enabled = formationOk && controlsPlayer(data.player); | data.button.enabled = formationOk && controlsPlayer(data.player); | ||||
let grayscale = formationOk ? "" : "grayscale:"; | let grayscale = formationOk ? "" : "grayscale:"; | ||||
data.guiSelection.hidden = !formationSelected; | data.guiSelection.hidden = !formationSelected; | ||||
data.icon.sprite = "stretched:" + grayscale + "session/icons/" + formationInfo.icon; | data.icon.sprite = "stretched:" + grayscale + "session/icons/" + formationInfo.icon; | ||||
setPanelObjectPosition(data.button, data.i, data.rowLength); | setPanelObjectPosition(data.button, data.i, data.rowLength); | ||||
▲ Show 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | else | ||||
return false; | return false; | ||||
} | } | ||||
data.button.onPress = function() { removeFromProductionQueue(data.item.producingEnt, queuedItem.id); }; | data.button.onPress = function() { removeFromProductionQueue(data.item.producingEnt, queuedItem.id); }; | ||||
let tooltip = getEntityNames(template); | let tooltip = getEntityNames(template); | ||||
if (queuedItem.neededSlots) | if (queuedItem.neededSlots) | ||||
{ | { | ||||
tooltip += "\n" + coloredText(translate("Insufficient population capacity:"), "red"); | tooltip += "\n" + setColor(translate("Insufficient population capacity:"), "red"); | ||||
tooltip += "\n" + sprintf(translate("%(population)s %(neededSlots)s"), { | tooltip += "\n" + sprintf(translate("%(population)s %(neededSlots)s"), { | ||||
"population": resourceIcon("population"), | "population": resourceIcon("population"), | ||||
"neededSlots": queuedItem.neededSlots | "neededSlots": queuedItem.neededSlots | ||||
}); | }); | ||||
} | } | ||||
data.button.tooltip = tooltip; | data.button.tooltip = tooltip; | ||||
data.countDisplay.caption = queuedItem.count > 1 ? queuedItem.count : ""; | data.countDisplay.caption = queuedItem.count > 1 ? queuedItem.count : ""; | ||||
▲ Show 20 Lines • Show All 557 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator