Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/selection_panels.js
Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
data.button.onPress = function() { | data.button.onPress = function() { | ||||
if (data.item.callback) | if (data.item.callback) | ||||
data.item.callback(data.item); | data.item.callback(data.item); | ||||
else | else | ||||
performCommand(data.unitEntStates, data.item.name); | performCommand(data.unitEntStates, data.item.name); | ||||
}; | }; | ||||
data.countDisplay.caption = data.item.count || ""; | data.countDisplay.caption = data.item.count || ""; | ||||
data.button.enabled = | data.button.enabled = data.item.enabled == true; | ||||
Freagarach: Could be deleted now, since the button is not visible. | |||||
Not Done Inline ActionsCan it be undefined? Stan: Can it be undefined? | |||||
Not Done Inline ActionsTheoretically, yes. Freagarach: Theoretically, yes. | |||||
g_IsObserver && data.item.name == "focus-rally" || | |||||
controlsPlayer(data.player) && (data.item.name != "delete" || | |||||
data.unitEntStates.some(state => !isUndeletable(state))); | |||||
data.icon.sprite = "stretched:session/icons/" + data.item.icon; | data.icon.sprite = "stretched:session/icons/" + data.item.icon; | ||||
let size = data.button.size; | let size = data.button.size; | ||||
// relative to the center ( = 50%) | // relative to the center ( = 50%) | ||||
size.rleft = 50; | size.rleft = 50; | ||||
size.rright = 50; | size.rright = 50; | ||||
// offset from the center calculation, count on square buttons, so size.bottom is the width too | // offset from the center calculation, count on square buttons, so size.bottom is the width too | ||||
size.left = (data.i - data.numberOfItems / 2) * (size.bottom + 1); | size.left = (data.i - data.numberOfItems / 2) * (size.bottom + 1); | ||||
size.right = size.left + size.bottom; | size.right = size.left + size.bottom; | ||||
data.button.size = size; | data.button.size = size; | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.AllyCommand = { | |||||
"getMaxNumberOfItems": function() | |||||
{ | |||||
return 2; | |||||
}, | |||||
"conflictsWith": ["Command"], | |||||
"getItems": function(unitEntStates) | |||||
{ | |||||
let commands = []; | |||||
for (let command in g_AllyEntityCommands) | |||||
for (let state of unitEntStates) | |||||
{ | |||||
let info = g_AllyEntityCommands[command].getInfo(state); | |||||
if (info) | |||||
{ | |||||
info.name = command; | |||||
commands.push(info); | |||||
break; | |||||
} | |||||
} | |||||
return commands; | |||||
}, | |||||
"setupButton": function(data) | |||||
{ | |||||
data.button.tooltip = data.item.tooltip; | |||||
data.button.onPress = function() { | |||||
if (data.item.callback) | |||||
data.item.callback(data.item); | |||||
else | |||||
performAllyCommand(data.unitEntStates[0].id, data.item.name); | |||||
}; | |||||
data.countDisplay.caption = data.item.count || ""; | |||||
data.button.enabled = !!data.item.count; | |||||
let grayscale = data.button.enabled ? "" : "grayscale:"; | |||||
data.icon.sprite = "stretched:" + grayscale + "session/icons/" + data.item.icon; | |||||
let size = data.button.size; | |||||
// relative to the center ( = 50%) | |||||
size.rleft = 50; | |||||
size.rright = 50; | |||||
// offset from the center calculation, count on square buttons, so size.bottom is the width too | |||||
size.left = (data.i - data.numberOfItems / 2) * (size.bottom + 1); | |||||
size.right = size.left + size.bottom; | |||||
data.button.size = size; | |||||
return true; | |||||
} | |||||
}; | |||||
g_SelectionPanels.Construction = { | g_SelectionPanels.Construction = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 24 - getNumberOfRightPanelButtons(); | return 24 - getNumberOfRightPanelButtons(); | ||||
}, | }, | ||||
"getItems": function() | "getItems": function() | ||||
{ | { | ||||
return getAllBuildableEntitiesFromSelection(); | return getAllBuildableEntitiesFromSelection(); | ||||
▲ Show 20 Lines • Show All 959 Lines • ▼ Show 20 Lines | let g_PanelsOrder = [ | ||||
"Pack", // Must always be shown on packable entities | "Pack", // Must always be shown on packable entities | ||||
"Upgrade", // Must always be shown on upgradable entities | "Upgrade", // Must always be shown on upgradable entities | ||||
"Training", | "Training", | ||||
"Construction", | "Construction", | ||||
"Research", // Normal together with training | "Research", // Normal together with training | ||||
// UNIQUE PANES (importance doesn't matter) | // UNIQUE PANES (importance doesn't matter) | ||||
"Command", | "Command", | ||||
"AllyCommand", | |||||
"Queue", | "Queue", | ||||
"Selection", | "Selection", | ||||
]; | ]; |
Wildfire Games · Phabricator
Could be deleted now, since the button is not visible.