fix(flows): egne flows øverst, kædeflows samlet nederst uden 'Kæde: ' (v1.61.2.0)
This commit is contained in:
@@ -52,20 +52,38 @@ end
|
||||
|
||||
-- Tavlen: forsyning ("Ind til bygning") først, så udkørsel ("Ud fra bygning"); hver gruppe efter navn.
|
||||
-- {{kind, runs}, ...}; tomme grupper udelades.
|
||||
-- Spillerens egne flows først (forsyning, udkørsel), så kædernes egne flows (run.chain) samlet til sidst
|
||||
-- (in-game 30/9: "Kæde: …"-flows blandede sig alfabetisk ind mellem de flows spilleren selv har sat op).
|
||||
function ADFlowView.boardGroups(runs)
|
||||
local byKind = {supply = {}, outbound = {}}
|
||||
local chainRuns = {}
|
||||
for _, run in ipairs(runs or {}) do
|
||||
table.insert(byKind[run.kind == "outbound" and "outbound" or "supply"], run)
|
||||
if run.chain ~= nil and run.chain ~= "" then
|
||||
table.insert(chainRuns, run)
|
||||
else
|
||||
table.insert(byKind[run.kind == "outbound" and "outbound" or "supply"], run)
|
||||
end
|
||||
end
|
||||
local groups = {}
|
||||
for _, kind in ipairs({"supply", "outbound"}) do
|
||||
if #byKind[kind] > 0 then
|
||||
table.insert(groups, {kind = kind, runs = sortedBy(byKind[kind], "name")})
|
||||
table.insert(groups, {kind = kind, chain = false, runs = sortedBy(byKind[kind], "name")})
|
||||
end
|
||||
end
|
||||
if #chainRuns > 0 then table.insert(groups, {kind = "supply", chain = true, runs = sortedBy(chainRuns, "name")}) end
|
||||
return groups
|
||||
end
|
||||
|
||||
-- Navn i listen: kædeflows står under overskriften "Kædernes egne flows", så "Kæde: " fjernes (ellers skjuler
|
||||
-- afkortningen hvilken bygning det gælder).
|
||||
function ADFlowView.listName(run)
|
||||
local name = tostring(run.name or "")
|
||||
if run.chain ~= nil and run.chain ~= "" then
|
||||
name = name:gsub("^Kæde:%s*", ""):gsub("^Chain:%s*", "")
|
||||
end
|
||||
return name
|
||||
end
|
||||
|
||||
-- Samme rækkefølge som tavlen, som én liste (flow-vælgeren).
|
||||
function ADFlowView.orderedRuns(runs)
|
||||
local result = {}
|
||||
|
||||
@@ -233,7 +233,7 @@ function SmartPickupFrame:fillFlowTabRows(adEnv)
|
||||
end
|
||||
self:addTextRow(i18n:getText("spu_flowList_hint"))
|
||||
for _, group in ipairs(ADFlowView.boardGroups(ADRunsController.store.runs)) do
|
||||
self:addTextRow(i18n:getText(group.kind == "outbound" and "spu_board_outbound" or "spu_board_supply"))
|
||||
self:addTextRow(i18n:getText(group.chain and "spu_board_chain" or group.kind == "outbound" and "spu_board_outbound" or "spu_board_supply"))
|
||||
for _, run in ipairs(group.runs) do
|
||||
local row = self:addRow(self.flowListPrefab, {kind = "flowList"})
|
||||
local entry = {runId = run.id, row = row, dot = row:getDescendantByName("dot"),
|
||||
@@ -266,7 +266,7 @@ function SmartPickupFrame:refreshFlowListRows(adEnv)
|
||||
local cells = self:flowCells(adEnv, run)
|
||||
local color = ADFlowView.LEVEL_COLORS[self:flowLevel(adEnv, run)]
|
||||
local canStop = ADRunsController.getRunStatus(adEnv, run).canStop
|
||||
entry.cells[1]:setText(tostring(run.name))
|
||||
entry.cells[1]:setText(ADFlowView.listName(run))
|
||||
entry.cells[2]:setText(tostring(cells[2]))
|
||||
entry.cells[3]:setText(tostring(cells[5]))
|
||||
entry.cells[4]:setText(tostring(cells[6]))
|
||||
|
||||
@@ -104,7 +104,7 @@ function SmartPickupFrame:fillOverviewRows(adEnv)
|
||||
self:addTextRow(i18n:getText("spu_overview_hint"))
|
||||
self:addCellRow(self.flowPrefab, {i18n:getText("spu_col_flow"), i18n:getText("spu_col_goods"), i18n:getText("spu_col_from"), i18n:getText("spu_col_to"), i18n:getText("spu_col_tractors"), i18n:getText("spu_col_status")})
|
||||
for _, group in ipairs(ADFlowView.boardGroups(ADRunsController.store.runs)) do
|
||||
self:addTextRow(i18n:getText(group.kind == "outbound" and "spu_board_outbound" or "spu_board_supply"))
|
||||
self:addTextRow(i18n:getText(group.chain and "spu_board_chain" or group.kind == "outbound" and "spu_board_outbound" or "spu_board_supply"))
|
||||
for _, run in ipairs(group.runs) do
|
||||
local cells = self:addCellRow(self.flowPrefab, self:flowCells(adEnv, run))
|
||||
if cells[1] ~= nil and cells[1].parent ~= nil then
|
||||
|
||||
@@ -377,6 +377,7 @@
|
||||
<text name="spu_col_to" text="Til"/>
|
||||
<text name="spu_col_tractors" text="Kører"/>
|
||||
<text name="spu_col_status" text="Status"/>
|
||||
<text name="spu_board_chain" text="· Kædernes egne flows (oprettes af fanen Kæder) ·"/>
|
||||
<text name="spu_board_supply" text="· Ind til bygning ·"/>
|
||||
<text name="spu_board_outbound" text="· Ud fra bygning ·"/>
|
||||
<text name="spu_showAllVehicles" text="Vis alle traktorer (%d skjult)"/>
|
||||
|
||||
@@ -377,6 +377,7 @@
|
||||
<text name="spu_col_to" text="To"/>
|
||||
<text name="spu_col_tractors" text="Running"/>
|
||||
<text name="spu_col_status" text="Status"/>
|
||||
<text name="spu_board_chain" text="· Flows created by chains (Chains tab) ·"/>
|
||||
<text name="spu_board_supply" text="· Into building ·"/>
|
||||
<text name="spu_board_outbound" text="· Out of building ·"/>
|
||||
<text name="spu_showAllVehicles" text="Show all tractors (%d hidden)"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.61.1.0</version>
|
||||
<version>1.61.2.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user