Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/selection_panels.js
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
setPanelObjectPosition(data.button, this.getMaxNumberOfItems() - data.i, data.rowLength); | setPanelObjectPosition(data.button, this.getMaxNumberOfItems() - data.i, data.rowLength); | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Barter = { | g_SelectionPanels.Barter = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 4; | return 4; | ||||
}, | }, | ||||
"rowLength": 4, | "rowLength": 4, | ||||
Nescio: Because there is now enough space for this. | |||||
"conflictsWith": ["Garrison"], | "conflictsWith": ["Garrison"], | ||||
"getItems": function(unitEntStates) | "getItems": function(unitEntStates) | ||||
{ | { | ||||
// If more than `rowLength` resources, don't display icons. | // If more than `rowLength` resources, don't display icons. | ||||
if (unitEntStates.every(state => !state.isBarterMarket) || g_ResourceData.GetBarterableCodes().length > this.rowLength) | if (unitEntStates.every(state => !state.isBarterMarket) || g_ResourceData.GetBarterableCodes().length > this.rowLength) | ||||
return []; | return []; | ||||
return g_ResourceData.GetBarterableCodes(); | return g_ResourceData.GetBarterableCodes(); | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Construction = { | g_SelectionPanels.Construction = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 24 - getNumberOfRightPanelButtons(); | return 40 - getNumberOfRightPanelButtons(); | ||||
}, | }, | ||||
"rowLength": 10, | |||||
"getItems": function() | "getItems": function() | ||||
{ | { | ||||
return getAllBuildableEntitiesFromSelection(); | return getAllBuildableEntitiesFromSelection(); | ||||
}, | }, | ||||
"setupButton": function(data) | "setupButton": function(data) | ||||
{ | { | ||||
let template = GetTemplateData(data.item, data.player); | let template = GetTemplateData(data.item, data.player); | ||||
if (!template) | if (!template) | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
setPanelObjectPosition(data.button, data.i + getNumberOfRightPanelButtons(), data.rowLength); | setPanelObjectPosition(data.button, data.i + getNumberOfRightPanelButtons(), data.rowLength); | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Formation = { | g_SelectionPanels.Formation = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 16; | return 16; | ||||
}, | }, | ||||
"rowLength": 4, | "rowLength": 4, | ||||
Done Inline ActionsThree rows of five makes fifteen. Nescio: Three rows of five makes fifteen.
The former value was wrong, a fourth row would occupy the… | |||||
"conflictsWith": ["Garrison"], | "conflictsWith": ["Garrison"], | ||||
"getItems": function(unitEntStates) | "getItems": function(unitEntStates) | ||||
{ | { | ||||
if (unitEntStates.some(state => !hasClass(state, "Unit"))) | if (unitEntStates.some(state => !hasClass(state, "Unit"))) | ||||
return []; | return []; | ||||
if (unitEntStates.every(state => !state.identity || !state.identity.hasSomeFormation)) | if (unitEntStates.every(state => !state.identity || !state.identity.hasSomeFormation)) | ||||
return []; | return []; | ||||
Show All 33 Lines | "setupButton": function(data) | ||||
setPanelObjectPosition(data.button, data.i, data.rowLength); | setPanelObjectPosition(data.button, data.i, data.rowLength); | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Garrison = { | g_SelectionPanels.Garrison = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 12; | return 12; | ||||
}, | }, | ||||
"rowLength": 4, | "rowLength": 4, | ||||
Done Inline ActionsThis is not changed to a row length of 5, because then there is not enough space for the health bar. Nescio: This is not changed to a row length of 5, because then there is not enough space for the health… | |||||
"conflictsWith": ["Barter"], | "conflictsWith": ["Barter"], | ||||
"getItems": function(unitEntStates) | "getItems": function(unitEntStates) | ||||
{ | { | ||||
if (unitEntStates.every(state => !state.garrisonHolder)) | if (unitEntStates.every(state => !state.garrisonHolder)) | ||||
return []; | return []; | ||||
let groups = new EntityGroups(); | let groups = new EntityGroups(); | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Gate = { | g_SelectionPanels.Gate = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 24 - getNumberOfRightPanelButtons(); | return 40 - getNumberOfRightPanelButtons(); | ||||
}, | }, | ||||
"rowLength": 10, | |||||
"getItems": function(unitEntStates) | "getItems": function(unitEntStates) | ||||
{ | { | ||||
let hideLocked = unitEntStates.every(state => !state.gate || !state.gate.locked); | let hideLocked = unitEntStates.every(state => !state.gate || !state.gate.locked); | ||||
let hideUnlocked = unitEntStates.every(state => !state.gate || state.gate.locked); | let hideUnlocked = unitEntStates.every(state => !state.gate || state.gate.locked); | ||||
if (hideLocked && hideUnlocked) | if (hideLocked && hideUnlocked) | ||||
return []; | return []; | ||||
Show All 23 Lines | "setupButton": function(data) | ||||
setPanelObjectPosition(data.button, data.i + getNumberOfRightPanelButtons(), data.rowLength); | setPanelObjectPosition(data.button, data.i + getNumberOfRightPanelButtons(), data.rowLength); | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Pack = { | g_SelectionPanels.Pack = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 24 - getNumberOfRightPanelButtons(); | return 40 - getNumberOfRightPanelButtons(); | ||||
}, | }, | ||||
"rowLength": 10, | |||||
"getItems": function(unitEntStates) | "getItems": function(unitEntStates) | ||||
{ | { | ||||
let checks = {}; | let checks = {}; | ||||
for (let state of unitEntStates) | for (let state of unitEntStates) | ||||
{ | { | ||||
if (!state.pack) | if (!state.pack) | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
setPanelObjectPosition(data.button, data.i, data.rowLength); | setPanelObjectPosition(data.button, data.i, data.rowLength); | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Research = { | g_SelectionPanels.Research = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 8; | return 10; | ||||
}, | }, | ||||
"rowLength": 10, | |||||
"getItems": function(unitEntStates) | "getItems": function(unitEntStates) | ||||
{ | { | ||||
let ret = []; | let ret = []; | ||||
if (unitEntStates.length == 1) | if (unitEntStates.length == 1) | ||||
return !unitEntStates[0].production || !unitEntStates[0].production.technologies ? ret : | return !unitEntStates[0].production || !unitEntStates[0].production.technologies ? ret : | ||||
unitEntStates[0].production.technologies.map(tech => ({ | unitEntStates[0].production.technologies.map(tech => ({ | ||||
"tech": tech, | "tech": tech, | ||||
"techCostMultiplier": unitEntStates[0].production.techCostMultiplier, | "techCostMultiplier": unitEntStates[0].production.techCostMultiplier, | ||||
▲ Show 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
setPanelObjectPosition(data.button, data.i, data.rowLength); | setPanelObjectPosition(data.button, data.i, data.rowLength); | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Training = { | g_SelectionPanels.Training = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 24 - getNumberOfRightPanelButtons(); | return 40 - getNumberOfRightPanelButtons(); | ||||
}, | }, | ||||
"rowLength": 10, | |||||
"getItems": function() | "getItems": function() | ||||
{ | { | ||||
return getAllTrainableEntitiesFromSelection(); | return getAllTrainableEntitiesFromSelection(); | ||||
}, | }, | ||||
"setupButton": function(data) | "setupButton": function(data) | ||||
{ | { | ||||
let template = GetTemplateData(data.item, data.player); | let template = GetTemplateData(data.item, data.player); | ||||
if (!template) | if (!template) | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | "setupButton": function(data) | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
g_SelectionPanels.Upgrade = { | g_SelectionPanels.Upgrade = { | ||||
"getMaxNumberOfItems": function() | "getMaxNumberOfItems": function() | ||||
{ | { | ||||
return 24 - getNumberOfRightPanelButtons(); | return 40 - getNumberOfRightPanelButtons(); | ||||
}, | }, | ||||
"rowLength": 10, | |||||
"getItems": function(unitEntStates) | "getItems": function(unitEntStates) | ||||
{ | { | ||||
// Interface becomes complicated with multiple different units and this is meant per-entity, so prevent it if the selection has multiple different units. | // Interface becomes complicated with multiple different units and this is meant per-entity, so prevent it if the selection has multiple different units. | ||||
if (unitEntStates.some(state => state.template != unitEntStates[0].template)) | if (unitEntStates.some(state => state.template != unitEntStates[0].template)) | ||||
return false; | return false; | ||||
return unitEntStates[0].upgrade && unitEntStates[0].upgrade.upgrades; | return unitEntStates[0].upgrade && unitEntStates[0].upgrade.upgrades; | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Because there is now enough space for this.