fix(gui): fanen Kæder efter Marker; kædelistens navne afkortes ikke (v1.61.1.0)

This commit is contained in:
2026-09-30 16:32:29 +02:00
parent a3d234a3a2
commit acf94c8e88
4 changed files with 18 additions and 7 deletions
+15 -5
View File
@@ -21,6 +21,14 @@ SmartPickupFrame.TAB_CHAINS = 10
SmartPickupFrame.CHAIN_REBUILD_TICKS = 30
-- Lagerfaner: én pr. bygningstype (indeks -> kind i ADSources.getFarmInventory)
SmartPickupFrame.TAB_NAMES = {"spu_tab_overview", "spu_tab_flows", "spu_tab_fields", "spu_tab_month", "spu_tab_fieldsilos", "spu_tab_factories", "spu_tab_silos", "spu_tab_barns", "spu_tab_sheds", "spu_tab_chains"}
-- Visningsrækkefølge (fane-id'erne ovenfor er faste og bruges overalt): Kæder står efter Marker (in-game 30/9).
SmartPickupFrame.TAB_DISPLAY = {1, 2, 3, 10, 4, 5, 6, 7, 8, 9}
function SmartPickupFrame.tabPosition(tabId)
for position, id in ipairs(SmartPickupFrame.TAB_DISPLAY) do
if id == tabId then return position end
end
return tabId
end
SmartPickupFrame.TAB_KINDS = {[6] = "factory", [7] = "silo", [8] = "husbandry", [9] = "objectStorage"}
function SmartPickupFrame.getTabKind(tab)
@@ -99,8 +107,9 @@ function SmartPickupFrame:initialize()
if self.selectorPrefab ~= nil and self.subCategoryBox ~= nil and self.subCategoryPaging ~= nil then
self.selectorPrefab:unlinkElement()
FocusManager:removeElement(self.selectorPrefab)
for index, key in ipairs(SmartPickupFrame.TAB_NAMES) do
self.subCategoryPaging:addText(tostring(index))
for position, index in ipairs(SmartPickupFrame.TAB_DISPLAY) do
local key = SmartPickupFrame.TAB_NAMES[index]
self.subCategoryPaging:addText(tostring(position))
local tab = self.selectorPrefab:clone(self.subCategoryBox)
FocusManager:loadElementFromCustomValues(tab)
tab:setText(self.i18n:getText(key))
@@ -270,11 +279,11 @@ function SmartPickupFrame:switchTab(tabIndex)
end
if self.guide ~= nil and not self:hasGuideOn(tabIndex) then self:closeGuide() end
self.currentTab = tabIndex
for index, tab in ipairs(self.subCategoryTabs) do
for index, tab in pairs(self.subCategoryTabs) do
tab:setSelected(index == tabIndex)
end
if self.subCategoryPaging ~= nil then
self.subCategoryPaging:setState(tabIndex, false)
self.subCategoryPaging:setState(SmartPickupFrame.tabPosition(tabIndex), false)
end
self:requestRebuild()
self:safe(function(frame)
@@ -282,8 +291,9 @@ function SmartPickupFrame:switchTab(tabIndex)
end)
end
-- pilene/paging giver en position i visningsrækkefølgen
function SmartPickupFrame:onClickTab(state)
self:switchTab(state)
self:switchTab(SmartPickupFrame.TAB_DISPLAY[state] or state)
end
-- De faste rækker: Flow-vælger + Wait-pulje for alle flows; Ture/kør hjem for forsyning; Sælg fra/