feat(ui): ny fane Overblik — flows som tabel (flow/varer/fra/til/kører/status) grupperet Ind/Ud + Wait-puljer; Flows-fanen kun redigering (v1.19.1.0)
This commit is contained in:
@@ -11,8 +11,9 @@ local function joinOr(list, empty)
|
||||
return table.concat(list, " + ")
|
||||
end
|
||||
|
||||
-- "Mælk · Kostald 1 + Kostald 2 → salg · pris ≥ 90 %, lager > 80 % · Virtus · kører (1/1) — SUGAR 78 % af top"
|
||||
function SmartPickupFrame:describeFlow(adEnv, run, isSelected)
|
||||
-- Én række i Oversigt: {flow, varer, fra, til, traktorer "kører/i alt", status}.
|
||||
-- Status = advarsel (!!), ellers begrundelse, ellers flowets regel.
|
||||
function SmartPickupFrame:flowCells(adEnv, run)
|
||||
local row = ADRunsController.getFlowRow(adEnv, run)
|
||||
local i18n = self.i18n
|
||||
local products
|
||||
@@ -53,51 +54,37 @@ function SmartPickupFrame:describeFlow(adEnv, run, isSelected)
|
||||
else
|
||||
rule = row.loops ~= nil and row.loops > 0 and string.format(i18n:getText("spu_flow_ruleInLoops"), row.loops) or i18n:getText("spu_flow_ruleIn")
|
||||
end
|
||||
local vehicles = joinOr(row.vehicleNames, i18n:getText("spu_flow_noVehicle"))
|
||||
local status = row.running > 0 and string.format(i18n:getText("spu_status_running"), row.running, row.total) or string.format(i18n:getText("spu_status_stopped"), row.total)
|
||||
local status = rule
|
||||
if row.warning ~= nil then
|
||||
status = status .. " — !! " .. row.warning
|
||||
status = "!! " .. row.warning
|
||||
elseif row.reason ~= nil then
|
||||
status = status .. " — " .. row.reason
|
||||
status = row.reason
|
||||
end
|
||||
local prefix = isSelected and "> " or " "
|
||||
return string.format("%s%s: %s · %s → %s · %s · %s · %s", prefix, run.name, products, from, to, rule, vehicles, status)
|
||||
local name = (run.id == self.selectedRunId and "> " or "") .. tostring(run.name)
|
||||
return {name, products, from, to, string.format("%d/%d", row.running, row.total), status}
|
||||
end
|
||||
|
||||
-- Tavlen klones bagest og flyttes derefter forrest i layoutet (foran de faste rækker).
|
||||
function SmartPickupFrame:fillBoardRows(adEnv)
|
||||
self.boardRows = {}
|
||||
local rows = {}
|
||||
local header = self:addTextRow(self.i18n:getText("spu_section_flows"))
|
||||
table.insert(rows, header.parent)
|
||||
-- grupperet: Ind til bygning, så Ud fra bygning — hver efter navn
|
||||
-- Fanen Oversigt: alle flows som tabel, grupperet Ind/Ud efter navn.
|
||||
function SmartPickupFrame:fillOverviewRows(adEnv)
|
||||
self.overviewRows = {}
|
||||
local i18n = self.i18n
|
||||
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
|
||||
table.insert(rows, self:addTextRow(self.i18n:getText(group.kind == "outbound" and "spu_board_outbound" or "spu_board_supply")).parent)
|
||||
self:addTextRow(i18n:getText(group.kind == "outbound" and "spu_board_outbound" or "spu_board_supply"))
|
||||
for _, run in ipairs(group.runs) do
|
||||
local title = self:addTextRow(self:describeFlow(adEnv, run, run.id == self.selectedRunId))
|
||||
table.insert(rows, title.parent)
|
||||
table.insert(self.boardRows, {run = run, title = title})
|
||||
table.insert(self.overviewRows, {runId = run.id, cells = self:addCellRow(self.flowPrefab, self:flowCells(adEnv, run))})
|
||||
end
|
||||
end
|
||||
if #ADRunsController.store.runs == 0 then
|
||||
table.insert(rows, self:addTextRow(self.i18n:getText("spu_noRuns")).parent)
|
||||
end
|
||||
local elements = self.boxLayout.elements
|
||||
for index = #rows, 1, -1 do
|
||||
for position = #elements, 1, -1 do
|
||||
if elements[position] == rows[index] then
|
||||
table.remove(elements, position)
|
||||
break
|
||||
end
|
||||
end
|
||||
table.insert(elements, 1, rows[index])
|
||||
self:addTextRow(i18n:getText("spu_noRuns"))
|
||||
end
|
||||
end
|
||||
|
||||
function SmartPickupFrame:refreshBoard(adEnv)
|
||||
for _, entry in ipairs(self.boardRows or {}) do
|
||||
if ADRuns.getRun(ADRunsController.store, entry.run.id) ~= nil then
|
||||
entry.title:setText(self:describeFlow(adEnv, ADRuns.getRun(ADRunsController.store, entry.run.id), entry.run.id == self.selectedRunId))
|
||||
function SmartPickupFrame:refreshOverview(adEnv)
|
||||
for _, entry in ipairs(self.overviewRows or {}) do
|
||||
local run = ADRuns.getRun(ADRunsController.store, entry.runId)
|
||||
if run ~= nil then
|
||||
SmartPickupFrame.setCells(entry.cells, self:flowCells(adEnv, run))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,10 +10,10 @@ SmartPickupFrame.REFRESH_INTERVAL_MS = 1000
|
||||
SmartPickupFrame.STATUS_OVERRIDE_TICKS = 6
|
||||
SmartPickupFrame.LOG_PREFIX = "ADSmartPickup: "
|
||||
SmartPickupFrame.STATE_OFF, SmartPickupFrame.STATE_ON = 1, 2
|
||||
SmartPickupFrame.TAB_FLOWS = 1
|
||||
SmartPickupFrame.TAB_OVERVIEW, SmartPickupFrame.TAB_FLOWS = 1, 2
|
||||
-- Lagerfaner: én pr. bygningstype (indeks -> kind i ADSources.getFarmInventory)
|
||||
SmartPickupFrame.TAB_NAMES = {"spu_tab_flows", "spu_tab_factories", "spu_tab_silos", "spu_tab_barns", "spu_tab_sheds"}
|
||||
SmartPickupFrame.TAB_KINDS = {[2] = "factory", [3] = "silo", [4] = "husbandry", [5] = "objectStorage"}
|
||||
SmartPickupFrame.TAB_NAMES = {"spu_tab_overview", "spu_tab_flows", "spu_tab_factories", "spu_tab_silos", "spu_tab_barns", "spu_tab_sheds"}
|
||||
SmartPickupFrame.TAB_KINDS = {[3] = "factory", [4] = "silo", [5] = "husbandry", [6] = "objectStorage"}
|
||||
|
||||
function SmartPickupFrame.getTabKind(tab)
|
||||
return SmartPickupFrame.TAB_KINDS[tab]
|
||||
@@ -38,7 +38,7 @@ function SmartPickupFrame.new(i18n, getAdEnv)
|
||||
self.pendingRebuild = false
|
||||
self.frameOpen = false
|
||||
self.focusLost = false
|
||||
self.currentTab = SmartPickupFrame.TAB_FLOWS
|
||||
self.currentTab = SmartPickupFrame.TAB_OVERVIEW
|
||||
self.subCategoryTabs = {}
|
||||
self.backButtonInfo = {inputAction = InputAction.MENU_BACK}
|
||||
self.startButtonInfo = {inputAction = InputAction.MENU_ACTIVATE, text = i18n:getText("spu_button_start"), callback = function() self:onClickStartStop() end}
|
||||
@@ -62,7 +62,7 @@ end
|
||||
|
||||
-- Prefabs skal ud af layoutet før de klones, ellers vises de selv som rækker.
|
||||
function SmartPickupFrame:initialize()
|
||||
for _, name in ipairs({"ingredientPrefab", "vehiclePrefab", "textPrefab", "productPrefab", "statPrefab", "gridPrefab"}) do
|
||||
for _, name in ipairs({"ingredientPrefab", "vehiclePrefab", "textPrefab", "productPrefab", "statPrefab", "gridPrefab", "flowPrefab"}) do
|
||||
local prefab = self[name]
|
||||
if prefab ~= nil then
|
||||
prefab:unlinkElement()
|
||||
@@ -370,6 +370,19 @@ function SmartPickupFrame:rebuild()
|
||||
self:refreshLive()
|
||||
return
|
||||
end
|
||||
if self.currentTab == SmartPickupFrame.TAB_OVERVIEW then
|
||||
if adEnv ~= nil then
|
||||
self:fillOverviewRows(adEnv)
|
||||
end
|
||||
self.statusRow = self:addTextRow("")
|
||||
self:addTextRow(self.i18n:getText("spu_waitPools"))
|
||||
self:fillPoolRows(adEnv)
|
||||
self:colorRows()
|
||||
self.boxLayout:invalidateLayout()
|
||||
self:refreshLive()
|
||||
self:restoreFocusIfLost()
|
||||
return
|
||||
end
|
||||
self:fillRunOption(adEnv)
|
||||
local hasRun = run ~= nil and adEnv ~= nil
|
||||
for _, element in ipairs({self.waitPoolOption, self.loopsOption, self.returnBelowOption, self.sellAtOption, self.storeAboveOption}) do
|
||||
@@ -377,9 +390,6 @@ function SmartPickupFrame:rebuild()
|
||||
element:setDisabled(not hasRun)
|
||||
end
|
||||
end
|
||||
if adEnv ~= nil then
|
||||
self:fillBoardRows(adEnv)
|
||||
end
|
||||
if hasRun then
|
||||
self:fillWaitPoolOption(adEnv, run)
|
||||
self:rebuildFlowDetail(adEnv, run)
|
||||
@@ -388,8 +398,6 @@ function SmartPickupFrame:rebuild()
|
||||
self:addTextRow(self.i18n:getText("spu_section_status"))
|
||||
end
|
||||
self.statusRow = self:addTextRow("")
|
||||
self:addTextRow(self.i18n:getText("spu_waitPools"))
|
||||
self:fillPoolRows(adEnv)
|
||||
self:colorRows()
|
||||
self.boxLayout:invalidateLayout()
|
||||
self:refreshLive()
|
||||
@@ -639,8 +647,8 @@ function SmartPickupFrame:refreshLive()
|
||||
self:setStatusText(self.i18n:getText("spu_status_noAd"))
|
||||
return
|
||||
end
|
||||
if self.currentTab == SmartPickupFrame.TAB_FLOWS then
|
||||
self:refreshBoard(adEnv)
|
||||
if self.currentTab == SmartPickupFrame.TAB_OVERVIEW then
|
||||
self:refreshOverview(adEnv)
|
||||
end
|
||||
self:refreshStorageRows(adEnv)
|
||||
local isRunning = false
|
||||
|
||||
@@ -72,6 +72,15 @@
|
||||
<Bitmap profile="fs25_multiTextOptionContainer" id="textPrefab">
|
||||
<Text profile="spuInfoText" name="title"/>
|
||||
</Bitmap>
|
||||
<!-- Oversigt: én række pr. flow (flow · varer · fra · til · traktorer · status). Rækken er ~815 px bred. -->
|
||||
<Bitmap profile="fs25_multiTextOptionContainer" id="flowPrefab">
|
||||
<Text profile="spuCellBold" name="c1" position="20px 0px" size="150px 40px"/>
|
||||
<Text profile="spuCell" name="c2" position="170px 0px" size="110px 40px"/>
|
||||
<Text profile="spuCell" name="c3" position="280px 0px" size="170px 40px"/>
|
||||
<Text profile="spuCell" name="c4" position="450px 0px" size="170px 40px"/>
|
||||
<Text profile="spuCell" name="c5" position="620px 0px" size="50px 40px"/>
|
||||
<Text profile="spuCell" name="c6" position="670px 0px" size="140px 40px"/>
|
||||
</Bitmap>
|
||||
<!-- Lagre: statistik-tabel (vare · i bygningen · værdi nu · ved toppris · gården · rækker til · forbrug/prod.) -->
|
||||
<Bitmap profile="fs25_multiTextOptionContainer" id="statPrefab">
|
||||
<Text profile="spuCellBold" name="c1" position="20px 0px" size="140px 40px"/>
|
||||
|
||||
@@ -135,6 +135,12 @@
|
||||
<text name="spu_stat_use" text="forbrug %s/døgn"/>
|
||||
<text name="spu_stat_prod" text="prod. %s/døgn"/>
|
||||
<text name="spu_stat_total" text="Bygningen i alt"/>
|
||||
<text name="spu_col_flow" text="Flow"/>
|
||||
<text name="spu_col_goods" text="Varer"/>
|
||||
<text name="spu_col_from" text="Fra"/>
|
||||
<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_supply" text="· Ind til bygning ·"/>
|
||||
<text name="spu_board_outbound" text="· Ud fra bygning ·"/>
|
||||
<text name="spu_showAllVehicles" text="Vis alle traktorer (%d skjult)"/>
|
||||
|
||||
@@ -135,6 +135,12 @@
|
||||
<text name="spu_stat_use" text="use %s/day"/>
|
||||
<text name="spu_stat_prod" text="prod. %s/day"/>
|
||||
<text name="spu_stat_total" text="Building total"/>
|
||||
<text name="spu_col_flow" text="Flow"/>
|
||||
<text name="spu_col_goods" text="Goods"/>
|
||||
<text name="spu_col_from" text="From"/>
|
||||
<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_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.19.0.0</version>
|
||||
<version>1.19.1.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
+10
-5
@@ -1,6 +1,6 @@
|
||||
# AD Smart Pickup — brugermanual
|
||||
|
||||
Version 1.19.0 · Farming Simulator 25 · tillæg til AutoDrive
|
||||
Version 1.19.1 · Farming Simulator 25 · tillæg til AutoDrive
|
||||
|
||||
*English version: [USER_MANUAL.md](USER_MANUAL.md)*
|
||||
|
||||
@@ -120,19 +120,24 @@ som er 25 m som standard. Står siloerne tættere, kan nabosiloen få læsset. S
|
||||
|
||||
## 4. Menuen Smart Pickup
|
||||
|
||||
Tryk **ESC** og vælg fanen **Smart Pickup**. Fanen har fem underfaner:
|
||||
Tryk **ESC** og vælg fanen **Smart Pickup**. Fanen har seks underfaner:
|
||||
|
||||
| Fane | Indhold |
|
||||
|---|---|
|
||||
| **Flows** | Tavlen med alle flows, redigering af det valgte flow og Wait-puljerne |
|
||||
| **Overblik** | Tabel over alle flows og Wait-puljerne |
|
||||
| **Flows** | Redigering af det valgte flow |
|
||||
| **Fabrikker** | Beholdning og statistik for gårdens fabrikker |
|
||||
| **Siloer** | Beholdning og statistik for gårdens siloer |
|
||||
| **Stalde** | Beholdning og statistik for gårdens stalde |
|
||||
| **Palleskure** | Beholdning og statistik for gårdens objektlagre |
|
||||
|
||||
### Flow-tavlen
|
||||
### Overblik
|
||||
|
||||
Øverst står én linje pr. flow. Det valgte flow er markeret med `>`.
|
||||
Fanen **Overblik** viser alle flows som en tabel med kolonnerne **Flow**, **Varer**, **Fra**, **Til**,
|
||||
**Kører** og **Status**. Det valgte flow er markeret med `>`. Kører viser traktorer i gang ud af flowets
|
||||
traktorer. Status viser en advarsel, grunden til at traktorerne holder, eller flowets regel.
|
||||
|
||||
Tidligere stod tavlen som én lang linje pr. flow:
|
||||
|
||||
```
|
||||
> Mælkesalg: Mælk · Cow Barn 1 + Cow Barn 2 → Salg · pris >= 90 %, lager > 80 % · Virtus · Kører (1/1)
|
||||
|
||||
+10
-5
@@ -1,6 +1,6 @@
|
||||
# AD Smart Pickup — user manual
|
||||
|
||||
Version 1.19.0 · Farming Simulator 25 · add-on for AutoDrive
|
||||
Version 1.19.1 · Farming Simulator 25 · add-on for AutoDrive
|
||||
|
||||
*Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)*
|
||||
|
||||
@@ -122,19 +122,24 @@ storage target with a neighbouring trigger.
|
||||
|
||||
## 4. The Smart Pickup menu
|
||||
|
||||
Press **ESC** and open the **Smart Pickup** tab. It has five sub-tabs:
|
||||
Press **ESC** and open the **Smart Pickup** tab. It has six sub-tabs:
|
||||
|
||||
| Tab | Contents |
|
||||
|---|---|
|
||||
| **Flows** | The board with all flows, editing of the selected flow and the Wait pools |
|
||||
| **Overview** | A table of all flows and the Wait pools |
|
||||
| **Flows** | Editing of the selected flow |
|
||||
| **Factories** | Inventory and statistics for the farm's factories |
|
||||
| **Silos** | Inventory and statistics for the farm's silos |
|
||||
| **Barns** | Inventory and statistics for the farm's barns |
|
||||
| **Pallet sheds** | Inventory and statistics for the farm's object storages |
|
||||
|
||||
### The flow board
|
||||
### Overview
|
||||
|
||||
At the top there is one line per flow. The selected flow is marked with `>`.
|
||||
The **Overview** tab shows all flows as a table with the columns **Flow**, **Goods**, **From**, **To**,
|
||||
**Running** and **Status**. The selected flow is marked with `>`. Running shows tractors at work out of
|
||||
the flow's tractors. Status shows a warning, the reason tractors are waiting, or the flow's rule.
|
||||
|
||||
Earlier the board was one long line per flow:
|
||||
|
||||
```
|
||||
> Milk sale: Milk · Cow Barn 1 + Cow Barn 2 → Sell · price >= 90 %, storage > 80 % · Virtus · Running (1/1)
|
||||
|
||||
Reference in New Issue
Block a user