diff --git a/FS25_ADSmartPickup/gui/SmartPickupFrame.lua b/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
index e55d80f..afc6367 100644
--- a/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
+++ b/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
@@ -84,7 +84,6 @@ function SmartPickupFrame:initialize()
self.subCategoryBox:invalidateLayout()
self.subCategoryPaging:setSize(self.subCategoryBox.maxFlowSize + 140 * g_pixelSizeScaledX)
end
- self.ingredientModeOption:setTexts({self.i18n:getText("spu_mode_auto"), self.i18n:getText("spu_mode_manual")})
local loopTexts = {self.i18n:getText("spu_loops_infinite")}
for loops = 1, ADRuns.MAX_LOOPS do
table.insert(loopTexts, tostring(loops))
@@ -109,7 +108,6 @@ function SmartPickupFrame:initialize()
end
if self.sellAtOption ~= nil then self.sellAtOption:setTexts(sellTexts) end
if self.storeAboveOption ~= nil then self.storeAboveOption:setTexts(storeTexts) end
- if self.collectRoundOption ~= nil then self.collectRoundOption:setTexts({self.i18n:getText("ui_no"), self.i18n:getText("ui_yes")}) end
end
-- Indeks i en trin-liste for en procent (største trin <= værdien).
@@ -255,8 +253,8 @@ function SmartPickupFrame:setStaticRowsVisible(tab)
local visibility = {
{self.runOption, isSupply or isOutbound},
{self.waitPoolOption, isSupply or isOutbound},
- {self.ingredientModeOption, isSupply}, {self.loopsOption, isSupply}, {self.returnBelowOption, isSupply},
- {self.sellAtOption, isOutbound}, {self.storeAboveOption, isOutbound}, {self.collectRoundOption, isOutbound},
+ {self.loopsOption, isSupply}, {self.returnBelowOption, isSupply},
+ {self.sellAtOption, isOutbound}, {self.storeAboveOption, isOutbound},
}
for _, entry in ipairs(visibility) do
local option = entry[1]
@@ -300,6 +298,18 @@ function SmartPickupFrame:clearRows()
self.overviewRows = {}
self.productRows, self.outboundStatusRows = {}, {}
self.storageRows = {}
+ self.ingredientModeRowOption, self.collectRoundRowOption = nil, nil
+end
+
+-- Ja/Nej-række som klon af ingredientPrefab (faste BinaryOption-elementer fra XML'en viser kun
+-- første valg grønt i FS25; klonede rækker virker begge veje). texts = {venstre, højre}.
+function SmartPickupFrame:addToggleRow(kind, title, texts, isOn)
+ local row = self:addRow(self.ingredientPrefab, {kind = kind})
+ local option = row:getDescendantByName("option")
+ option:setTexts(texts)
+ option:setState(isOn and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false)
+ row:getDescendantByName("title"):setText(title)
+ return option
end
function SmartPickupFrame:addRow(prefab, data)
@@ -376,7 +386,7 @@ function SmartPickupFrame:rebuild()
self:fillRunOption(adEnv)
local run = self:getRun()
local hasRun = run ~= nil and adEnv ~= nil
- for _, element in ipairs({self.ingredientModeOption, self.waitPoolOption, self.loopsOption, self.returnBelowOption, self.sellAtOption, self.storeAboveOption, self.collectRoundOption}) do
+ for _, element in ipairs({self.waitPoolOption, self.loopsOption, self.returnBelowOption, self.sellAtOption, self.storeAboveOption}) do
if element ~= nil then
element:setDisabled(not hasRun)
end
@@ -528,10 +538,10 @@ function SmartPickupFrame:syncOptionsFromModel(adEnv, run)
if run.kind == "outbound" then
sync(self.sellAtOption, SmartPickupFrame.getStepIndex(self.sellAtSteps, run.sellAtPercent, ADRuns.DEFAULT_SELL_AT_PERCENT))
sync(self.storeAboveOption, SmartPickupFrame.getStepIndex(self.storeAboveSteps, run.storeAbovePercent, ADRuns.DEFAULT_STORE_ABOVE_PERCENT))
- sync(self.collectRoundOption, run.collectRound and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF)
+ sync(self.collectRoundRowOption, run.collectRound and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF)
return
end
- sync(self.ingredientModeOption, run.ingredientMode == "manual" and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF)
+ sync(self.ingredientModeRowOption, run.ingredientMode == "manual" and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF)
sync(self.loopsOption, run.loops + 1)
sync(self.returnBelowOption, self:getReturnBelowIndex(run))
end
@@ -740,6 +750,10 @@ function SmartPickupFrame:onClickIngredient(state, element)
return self:onClickTarget(state, element)
elseif data ~= nil and data.kind == "source" then
return self:onClickSource(state, element)
+ elseif data ~= nil and data.kind == "ingredientMode" then
+ return self:onClickIngredientMode(state)
+ elseif data ~= nil and data.kind == "collectRound" then
+ return self:onClickCollectRound(state)
end
self:safe(function(frame)
local run, data = frame:getRun(), frame.rowData[element]
diff --git a/FS25_ADSmartPickup/gui/SmartPickupFrame.xml b/FS25_ADSmartPickup/gui/SmartPickupFrame.xml
index 56c1a7c..f433f2a 100644
--- a/FS25_ADSmartPickup/gui/SmartPickupFrame.xml
+++ b/FS25_ADSmartPickup/gui/SmartPickupFrame.xml
@@ -25,12 +25,6 @@
-
-
-
-
-
-
@@ -62,12 +56,6 @@
-
-
-
-
-
-
diff --git a/FS25_ADSmartPickup/gui/SmartPickupOutboundTab.lua b/FS25_ADSmartPickup/gui/SmartPickupOutboundTab.lua
index 53e3c29..b365c24 100644
--- a/FS25_ADSmartPickup/gui/SmartPickupOutboundTab.lua
+++ b/FS25_ADSmartPickup/gui/SmartPickupOutboundTab.lua
@@ -110,7 +110,7 @@ end
function SmartPickupFrame:rebuildOutboundTab(adEnv, run)
self.sellAtOption:setState(SmartPickupFrame.getStepIndex(self.sellAtSteps, run.sellAtPercent, ADRuns.DEFAULT_SELL_AT_PERCENT), false)
self.storeAboveOption:setState(SmartPickupFrame.getStepIndex(self.storeAboveSteps, run.storeAbovePercent, ADRuns.DEFAULT_STORE_ABOVE_PERCENT), false)
- self.collectRoundOption:setState(run.collectRound and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false)
+ self.collectRoundRowOption = self:addToggleRow("collectRound", self.i18n:getText("spu_collectRound"), {self.i18n:getText("ui_no"), self.i18n:getText("ui_yes")}, run.collectRound == true)
self:addTextRow(self.i18n:getText("spu_section_sources"))
self:fillSourceRows(adEnv, run)
self:addTextRow(self.i18n:getText("spu_section_products"))
diff --git a/FS25_ADSmartPickup/gui/SmartPickupSupplyTab.lua b/FS25_ADSmartPickup/gui/SmartPickupSupplyTab.lua
index 3521749..1b14586 100644
--- a/FS25_ADSmartPickup/gui/SmartPickupSupplyTab.lua
+++ b/FS25_ADSmartPickup/gui/SmartPickupSupplyTab.lua
@@ -3,10 +3,10 @@
-- Funktionerne lægges på SmartPickupFrame (indlæses efter SmartPickupFrame.lua).
function SmartPickupFrame:rebuildSupplyTab(adEnv, run)
- self.ingredientModeOption:setState(run.ingredientMode == "manual" and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false)
self.loopsOption:setState(run.loops + 1, false)
self.returnBelowOption:setState(self:getReturnBelowIndex(run), false)
self:addTextRow(self.i18n:getText("spu_section_targets"))
+ self.ingredientModeRowOption = self:addToggleRow("ingredientMode", self.i18n:getText("spu_ingredientMode"), {self.i18n:getText("spu_mode_auto"), self.i18n:getText("spu_mode_manual")}, run.ingredientMode == "manual")
self:addTextRow(self.i18n:getText("spu_targets"))
self:fillTargetRows(adEnv, run)
self:fillIngredientRows(adEnv, run)
diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml
index 2951025..1e69dfd 100644
--- a/FS25_ADSmartPickup/modDesc.xml
+++ b/FS25_ADSmartPickup/modDesc.xml
@@ -1,7 +1,7 @@
masterdraco
- 1.12.16.0
+ 1.12.17.0
AD Smart Pickup