feat: manualen i spillet — (?)-hjælp pr. række, Hjælp-knap, indhold og søgning
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
-- AD Help
|
||||
-- Manualen i spillet (brugerønske 20/10: "?" ud for hver ting man kan indstille + hele manualen med søgning).
|
||||
-- help/help_<sprog>.xml bygges af tools/build_help.py ud fra docs/*.md: et <section> pr. afsnit og <alias> fra en
|
||||
-- række/et trin i menuen til sit afsnit. Ren logik øverst (testes med luajit), indlæsning nederst.
|
||||
|
||||
ADHelp = {}
|
||||
ADHelp.SEARCH_MAX = 30
|
||||
ADHelp.SNIPPET_CHARS = 70
|
||||
|
||||
-- ---- ren logik ----
|
||||
|
||||
-- Menuens række -> hjælpe-id. data = rækkens rowData; ctx = {guideKind = "flow"|"field", direction = "out"|"in"}.
|
||||
-- Guide-rækker: "<guide>.<række-id>"; Indstillinger: "set.<nøgle>"; Marksiloer: "fs.<art>". nil = ingen hjælp.
|
||||
function ADHelp.rowId(data, ctx)
|
||||
if type(data) ~= "table" then return nil end
|
||||
local kind = data.kind
|
||||
if kind == "guideRow" and data.row ~= nil and data.row.id ~= nil and ctx ~= nil and ctx.guideKind ~= nil then
|
||||
return ctx.guideKind .. "." .. tostring(data.row.id)
|
||||
end
|
||||
if (kind == "setGlobal" or kind == "setBuilding" or kind == "setBarnOnly") and data.key ~= nil then return "set." .. data.key end
|
||||
if kind == "lockTractor" then return "set.lockTractor" end
|
||||
if kind == "settingsSection" then return "set.section" end
|
||||
if type(kind) == "string" and kind:sub(1, 2) == "fs" then return "fs." .. kind end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Guidens trin -> hjælpe-id ("flowstep.rules")
|
||||
function ADHelp.stepId(guideKind, step)
|
||||
if guideKind == nil or step == nil then return nil end
|
||||
return guideKind .. "step." .. tostring(step)
|
||||
end
|
||||
|
||||
-- Findes der hjælp til id'et? Retningen først ("flowstep.rules.out"), så det generelle. -> alias | nil
|
||||
function ADHelp.findAlias(data, id, direction)
|
||||
if data == nil or id == nil then return nil end
|
||||
if direction ~= nil and data.aliases[id .. "." .. direction] ~= nil then return data.aliases[id .. "." .. direction] end
|
||||
return data.aliases[id]
|
||||
end
|
||||
|
||||
-- Byteposition flyttet frem til starten af et utf-8-tegn (æ/ø/å er to bytes; et uddrag må ikke klippe dem over)
|
||||
function ADHelp.charStart(text, position)
|
||||
local index = math.max(1, position)
|
||||
while index <= #text do
|
||||
local byte = string.byte(text, index)
|
||||
if byte < 0x80 or byte >= 0xC0 then break end
|
||||
index = index + 1
|
||||
end
|
||||
return index
|
||||
end
|
||||
|
||||
local function lower(text)
|
||||
-- æ/ø/å skrives ens i søgeord og tekst (utf-8 byte-sekvenser), så kun ASCII-bogstaver foldes
|
||||
return string.lower(tostring(text or ""))
|
||||
end
|
||||
|
||||
-- Søgning i alle afsnit: alle ord skal stå i titel eller tekst; titeltræffere først. -> {{section, snippet}}
|
||||
function ADHelp.search(sections, query, max)
|
||||
local words = {}
|
||||
for word in string.gmatch(lower(query), "%S+") do table.insert(words, word) end
|
||||
if #words == 0 then return {} end
|
||||
local titleHits, textHits = {}, {}
|
||||
for _, section in ipairs(sections or {}) do
|
||||
local title = lower(section.title)
|
||||
local body = lower(table.concat(section.paragraphs or {}, " "))
|
||||
local all, inTitle = true, true
|
||||
for _, word in ipairs(words) do
|
||||
local t = string.find(title, word, 1, true) ~= nil
|
||||
if not t and string.find(body, word, 1, true) == nil then all = false break end
|
||||
inTitle = inTitle and t
|
||||
end
|
||||
if all then
|
||||
local snippet = ""
|
||||
local full = table.concat(section.paragraphs or {}, " ")
|
||||
local at = string.find(lower(full), words[1], 1, true)
|
||||
if at ~= nil then
|
||||
local from = ADHelp.charStart(full, at - 20)
|
||||
local to = ADHelp.charStart(full, from + ADHelp.SNIPPET_CHARS + 1) - 1
|
||||
snippet = (from > 1 and "…" or "") .. string.sub(full, from, to) .. (to < #full and "…" or "")
|
||||
end
|
||||
table.insert(inTitle and titleHits or textHits, {section = section, snippet = snippet})
|
||||
end
|
||||
end
|
||||
local result = {}
|
||||
for _, list in ipairs({titleHits, textHits}) do
|
||||
for _, hit in ipairs(list) do
|
||||
if #result < (max or ADHelp.SEARCH_MAX) then table.insert(result, hit) end
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
-- Underafsnit (dybere niveau, lige efter afsnittet) -> liste af sektioner
|
||||
function ADHelp.children(sections, index)
|
||||
local parent = sections[index]
|
||||
local list = {}
|
||||
if parent == nil then return list end
|
||||
for i = index + 1, #sections do
|
||||
local section = sections[i]
|
||||
if section.level <= parent.level then break end
|
||||
if section.level == parent.level + 1 then table.insert(list, section) end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
-- ---- indlæsning ----
|
||||
|
||||
local loaded = nil -- {sections = {}, byId = {}, indexOf = {}, aliases = {}}
|
||||
|
||||
local function readParagraphs(xml, key)
|
||||
local list = {}
|
||||
xml:iterate(key .. ".p", function(_, pKey) table.insert(list, xml:getString(pKey) or "") end)
|
||||
return list
|
||||
end
|
||||
|
||||
-- Hjælpen på spillets sprog (dansk, ellers engelsk). Indlæses én gang.
|
||||
function ADHelp.get()
|
||||
if loaded ~= nil then return loaded end
|
||||
loaded = {sections = {}, byId = {}, indexOf = {}, aliases = {}}
|
||||
if XMLFile == nil or ADSmartPickup == nil or ADSmartPickup.dir == nil then return loaded end
|
||||
local lang = (g_languageShort == "da") and "da" or "en"
|
||||
local path = ADSmartPickup.dir .. "help/help_" .. lang .. ".xml"
|
||||
if fileExists ~= nil and not fileExists(path) then path = ADSmartPickup.dir .. "help/help_en.xml" end
|
||||
local xml = XMLFile.load("spuHelp", path)
|
||||
if xml == nil then
|
||||
Logging.warning("ADSmartPickup: hjælpen kunne ikke indlæses (%s)", tostring(path))
|
||||
return loaded
|
||||
end
|
||||
local ok, err = pcall(function()
|
||||
xml:iterate("help.section", function(_, key)
|
||||
local section = {id = xml:getString(key .. "#id"), level = xml:getInt(key .. "#level") or 3,
|
||||
title = xml:getString(key .. "#title") or "", paragraphs = readParagraphs(xml, key)}
|
||||
table.insert(loaded.sections, section)
|
||||
loaded.byId[section.id] = section
|
||||
loaded.indexOf[section.id] = #loaded.sections
|
||||
end)
|
||||
xml:iterate("help.alias", function(_, key)
|
||||
local id = xml:getString(key .. "#id")
|
||||
if id ~= nil then
|
||||
loaded.aliases[id] = {id = id, ref = xml:getString(key .. "#ref"), title = xml:getString(key .. "#title"),
|
||||
paragraphs = readParagraphs(xml, key)}
|
||||
end
|
||||
end)
|
||||
end)
|
||||
xml:delete()
|
||||
if not ok then
|
||||
-- halvt indlæst hjælp er værre end ingen: tom, og en advarsel (review 20/10)
|
||||
Logging.warning("ADSmartPickup: hjælpen fejlede under indlæsning: %s", tostring(err))
|
||||
loaded = {sections = {}, byId = {}, indexOf = {}, aliases = {}}
|
||||
end
|
||||
return loaded
|
||||
end
|
||||
@@ -45,6 +45,7 @@ if ADSmartPickup.dir ~= nil and source ~= nil then
|
||||
source(ADSmartPickup.dir .. "gui/SmartPickupFlowGuide.lua")
|
||||
source(ADSmartPickup.dir .. "gui/SmartPickupEditPanel.lua")
|
||||
source(ADSmartPickup.dir .. "gui/SmartPickupAttentionFlow.lua")
|
||||
source(ADSmartPickup.dir .. "gui/SmartPickupHelp.lua") -- sidst: lægger sig om rebuild m.fl.
|
||||
end
|
||||
|
||||
-- Markøren er dér hvor trækkerens næse stopper; læssetriggeren ligger et
|
||||
|
||||
@@ -81,6 +81,8 @@ function SmartPickupFrame.new(i18n, getAdEnv)
|
||||
-- Flows: [Start/Stop] [Opsæt flow] [Nyt flow] [Slet] (gui/SmartPickupFlowGuide.lua)
|
||||
self:initFlowButtons(i18n)
|
||||
self:initEditPanelButtons(i18n)
|
||||
-- Hjælp-knappen og hjælpevisningens knapper (gui/SmartPickupHelp.lua)
|
||||
if self.initHelpButtons ~= nil then self:initHelpButtons(i18n) end
|
||||
-- Egen reference til listen: fallback'en i refreshButtons skal kunne sende den igen.
|
||||
self.menuButtonInfo = self.overviewButtons
|
||||
self:setMenuButtonInfo(self.menuButtonInfo)
|
||||
@@ -208,8 +210,10 @@ end
|
||||
-- rebuild sletter de rækker der kan have fokus (fx vare-rækkerne når Varer skifter til
|
||||
-- Auto); uden dette står fokus på et slettet element og tastatur/controller er død.
|
||||
function SmartPickupFrame:restoreFocusIfLost()
|
||||
if self.focusLost and self.frameOpen and self.boxLayout ~= nil then
|
||||
FocusManager:setFocus(self.boxLayout)
|
||||
-- redigeringsvinduet åbent: fokus i vinduet (listen bag det er skjult — review 20/10)
|
||||
local target = (self.editPanelOpen and self.editLayout ~= nil) and self.editLayout or self.boxLayout
|
||||
if self.focusLost and self.frameOpen and target ~= nil then
|
||||
FocusManager:setFocus(target)
|
||||
end
|
||||
self.focusLost = false
|
||||
end
|
||||
|
||||
@@ -123,7 +123,8 @@ function SmartPickupFrame:fillGuideRows(adEnv)
|
||||
else
|
||||
header = string.format(self.i18n:getText("spu_guide_stepOne"), index or 1, stepTitle)
|
||||
end
|
||||
self:addTextRow(header)
|
||||
-- trinnets overskrift med "(?)": klik åbner manualens afsnit om trinnet
|
||||
self:addHelpHeader(header, ADHelp.stepId(self.guideKind, guide.step))
|
||||
self:addTextRow(" " .. self.i18n:getText(model.hintKey(guide.step, guide)))
|
||||
for _, row in ipairs(model.rows(guide)) do
|
||||
self:addGuideRow(row)
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
-- Smart Pickup — hjælp: manualen i spillet (brugerønske 20/10)
|
||||
-- "(?)" efter titlen på hver række med et hjælpeafsnit (klik på titlen), knappen Hjælp (hjælp til den markerede
|
||||
-- række, ellers indholdsfortegnelsen), hele manualen som indhold med links og søgning. Hjælpen vises i listen
|
||||
-- eller i redigeringsvinduet, hvor den blev åbnet; Tilbage går et skridt tilbage, til sidst ud af hjælpen.
|
||||
-- Data og ren logik: adHelp.lua. Indlæses efter de øvrige gui-filer: lægger sig om rebuild/fillEditPanel/
|
||||
-- refreshLive/refreshButtons/switchTab/onFrameClose/openEditPanel/hideEditPanel.
|
||||
|
||||
SmartPickupFrame.HELP_SUFFIX = " (?)"
|
||||
local INDENT = {[2] = "", [3] = " ", [4] = " "}
|
||||
|
||||
function SmartPickupFrame:initHelpButtons(i18n)
|
||||
self.helpButtonInfo = {inputAction = InputAction.MENU_EXTRA_1, text = i18n:getText("spu_help_button"), callback = function() self:onClickHelp() end}
|
||||
self.helpBackButtonInfo = {inputAction = InputAction.MENU_BACK, text = i18n:getText("spu_help_back"), callback = function() self:helpBack() end}
|
||||
self.helpSearchButtonInfo = {inputAction = InputAction.MENU_EXTRA_1, text = i18n:getText("spu_help_search"), callback = function() self:onClickHelpSearch() end}
|
||||
self.helpTocButtonInfo = {inputAction = InputAction.MENU_EXTRA_2, text = i18n:getText("spu_help_toc"), callback = function() self:openHelpView({mode = "toc"}) end}
|
||||
self.helpViewButtons = {self.helpBackButtonInfo, self.helpSearchButtonInfo, self.helpTocButtonInfo}
|
||||
-- Hjælp-knappen hvor MENU_EXTRA_1 er fri: Måned/Marksiloer/Kæder/Indstillinger, lagerfanerne, guidens trin
|
||||
-- (ikke oversigten — dér er den "Gem uden at starte") og redigeringsvinduet
|
||||
for _, list in ipairs({self.monthButtons, self.storageButtons, self.guideButtons, self.panelButtons, self.panelButtonsNoDelete}) do
|
||||
if list ~= nil then table.insert(list, self.helpButtonInfo) end
|
||||
end
|
||||
end
|
||||
|
||||
-- ---- tilstand ----
|
||||
|
||||
-- Hjælpen vises igen: i redigeringsvinduet kun vinduet (listen bagved bygges ikke om — review 20/10), ellers listen
|
||||
local function showHelp(self)
|
||||
if self.editPanelOpen and self:editPanelHooks() ~= nil then
|
||||
self:fillEditPanel(self.getAdEnv())
|
||||
self:refreshButtons()
|
||||
self:restoreFocusIfLost() -- den fokuserede række blev slettet: fokus i vinduet
|
||||
else
|
||||
self:requestRebuild()
|
||||
end
|
||||
end
|
||||
|
||||
function SmartPickupFrame:openHelpView(view)
|
||||
if self.helpView ~= nil then
|
||||
self.helpStack = self.helpStack or {}
|
||||
table.insert(self.helpStack, self.helpView)
|
||||
end
|
||||
self.helpView = view
|
||||
showHelp(self)
|
||||
end
|
||||
|
||||
-- Tilbage: forrige hjælpevisning, ellers ud af hjælpen. ESC og knappen kan komme for samme tryk (panelClosedAt)
|
||||
function SmartPickupFrame:helpBack()
|
||||
if g_time ~= nil and self.panelClosedAt ~= nil and g_time - self.panelClosedAt < SmartPickupFrame.PANEL_ESC_DEBOUNCE_MS then return end
|
||||
self.panelClosedAt = g_time
|
||||
local stack = self.helpStack or {}
|
||||
self.helpView = table.remove(stack)
|
||||
self.helpStack = stack
|
||||
showHelp(self)
|
||||
end
|
||||
|
||||
function SmartPickupFrame:closeHelp()
|
||||
self.helpView, self.helpStack = nil, {}
|
||||
end
|
||||
|
||||
function SmartPickupFrame:openHelpAlias(alias)
|
||||
if alias == nil then return end
|
||||
self:openHelpView({mode = "section", id = alias.ref, alias = alias})
|
||||
end
|
||||
|
||||
function SmartPickupFrame:helpContext()
|
||||
local direction = nil
|
||||
if self.guide ~= nil and self.guide.draft ~= nil and self.guideKind == "flow" then
|
||||
direction = self.guide.draft.kind == "outbound" and "out" or "in"
|
||||
end
|
||||
return {guideKind = self.guideKind, direction = direction}
|
||||
end
|
||||
|
||||
function SmartPickupFrame:aliasForData(data)
|
||||
local ctx = self:helpContext()
|
||||
return ADHelp.findAlias(ADHelp.get(), ADHelp.rowId(data, ctx), ctx.direction)
|
||||
end
|
||||
|
||||
-- Knappen Hjælp: den markerede række, ellers guidens trin, ellers indholdsfortegnelsen
|
||||
function SmartPickupFrame:onClickHelp()
|
||||
self:safe(function(frame)
|
||||
local focused = SmartPickupFrame.getFocusedElement()
|
||||
local alias = focused ~= nil and frame:aliasForData(frame.rowData[focused]) or nil
|
||||
if alias == nil and frame.guide ~= nil then
|
||||
local ctx = frame:helpContext()
|
||||
alias = ADHelp.findAlias(ADHelp.get(), ADHelp.stepId(frame.guideKind, frame.guide.step), ctx.direction)
|
||||
end
|
||||
if alias ~= nil then frame:openHelpAlias(alias) else frame:openHelpView({mode = "toc"}) end
|
||||
end)
|
||||
end
|
||||
|
||||
function SmartPickupFrame:onClickHelpSearch()
|
||||
self:safe(function(frame)
|
||||
local current = frame.helpView ~= nil and frame.helpView.query or ""
|
||||
TextInputDialog.show(SmartPickupFrame.onHelpSearchResult, frame, current, frame.i18n:getText("spu_help_searchTitle"), nil, 40, g_i18n:getText("button_ok"))
|
||||
end)
|
||||
end
|
||||
|
||||
function SmartPickupFrame:onHelpSearchResult(value, clickOk)
|
||||
self:safe(function(frame)
|
||||
if not clickOk or value == nil or not tostring(value):match("%S") then return end
|
||||
frame:openHelpView({mode = "search", query = tostring(value)})
|
||||
end)
|
||||
end
|
||||
|
||||
-- Overskrift på et guide-trin med "(?)", klikbar når trinnet har et hjælpeafsnit
|
||||
function SmartPickupFrame:addHelpHeader(text, stepId)
|
||||
local ctx = self:helpContext()
|
||||
local alias = ADHelp.findAlias(ADHelp.get(), stepId, ctx.direction)
|
||||
if alias == nil then return self:addTextRow(text) end
|
||||
return self:addLinkRow(text .. SmartPickupFrame.HELP_SUFFIX, function(frame) frame:openHelpAlias(alias) end)
|
||||
end
|
||||
|
||||
-- Klik på titlen (ikke hele rækken: et fejlklik ved valgpilene må ikke åbne hjælpen — review 20/10)
|
||||
local MOUSE_LEFT = Input ~= nil and Input.MOUSE_BUTTON_LEFT or 1
|
||||
local function inside(element, x, y)
|
||||
local position, size = element.absPosition, element.absSize
|
||||
return position ~= nil and size ~= nil and x >= position[1] and x <= position[1] + size[1] and y >= position[2] and y <= position[2] + size[2]
|
||||
end
|
||||
|
||||
function SmartPickupFrame:makeTitleClickable(row, title, action)
|
||||
local frame = self
|
||||
local baseMouseEvent = row.mouseEvent
|
||||
row.mouseEvent = function(element, posX, posY, isDown, isUp, button, eventUsed)
|
||||
local used = baseMouseEvent(element, posX, posY, isDown, isUp, button, eventUsed)
|
||||
local layout = element.spuLayout or frame.boxLayout
|
||||
local blockedByPanel = frame.editPanelOpen and layout == frame.boxLayout
|
||||
if not used and not eventUsed and not blockedByPanel and isUp and button == MOUSE_LEFT
|
||||
and inside(title, posX, posY) and inside(layout, posX, posY) then
|
||||
frame.pendingClick = action
|
||||
return true
|
||||
end
|
||||
return used
|
||||
end
|
||||
end
|
||||
|
||||
-- "(?)" på rækker med et hjælpeafsnit; klik på titlen åbner det (valget selv virker som før). Deler flere rækker
|
||||
-- samme afsnit (én pr. stald, én pr. vare), får kun den første "(?)" — ryddeligt
|
||||
function SmartPickupFrame:decorateHelpRows(rows)
|
||||
local shown = {}
|
||||
for _, row in ipairs(rows or {}) do
|
||||
if not row.spuHelpDone then
|
||||
row.spuHelpDone = true
|
||||
local option = row:getDescendantByName("option")
|
||||
local alias = option ~= nil and self:aliasForData(self.rowData[option]) or nil
|
||||
if alias ~= nil and shown[alias.id] then alias = nil end
|
||||
local title = alias ~= nil and row:getDescendantByName("title") or nil
|
||||
if title ~= nil then
|
||||
shown[alias.id] = true
|
||||
title:setText(tostring(title.text or "") .. SmartPickupFrame.HELP_SUFFIX)
|
||||
self:makeTitleClickable(row, title, function(frame) frame:openHelpAlias(alias) end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ---- visning ----
|
||||
|
||||
local function addParagraphs(frame, paragraphs)
|
||||
for _, paragraph in ipairs(paragraphs or {}) do frame:addTextRow(paragraph) end
|
||||
end
|
||||
|
||||
function SmartPickupFrame:fillHelpRows()
|
||||
local help, view, i18n = ADHelp.get(), self.helpView, self.i18n
|
||||
self:addTextRow(i18n:getText("spu_help_title"))
|
||||
if #help.sections == 0 then
|
||||
self:addTextRow(i18n:getText("spu_help_missing"))
|
||||
elseif view.mode == "search" then
|
||||
local hits = ADHelp.search(help.sections, view.query, ADHelp.SEARCH_MAX)
|
||||
self:addTextRow(string.format(i18n:getText("spu_help_results"), tostring(view.query), #hits))
|
||||
for _, hit in ipairs(hits) do
|
||||
local id = hit.section.id
|
||||
self:addLinkRow(" " .. hit.section.title, function(frame) frame:openHelpView({mode = "section", id = id}) end)
|
||||
if hit.snippet ~= "" then self:addTextRow(" " .. hit.snippet) end
|
||||
end
|
||||
elseif view.mode == "section" and help.byId[view.id] ~= nil then
|
||||
local section, alias = help.byId[view.id], view.alias
|
||||
if alias ~= nil and #(alias.paragraphs or {}) > 0 then
|
||||
-- en indstilling (tabelrække): dens egen tekst, så link til hele afsnittet
|
||||
self:addTextRow(tostring(alias.title or section.title))
|
||||
addParagraphs(self, alias.paragraphs)
|
||||
self:addLinkRow(string.format(i18n:getText("spu_help_whole"), section.title), function(frame) frame:openHelpView({mode = "section", id = section.id}) end)
|
||||
else
|
||||
self:addTextRow(section.title)
|
||||
addParagraphs(self, section.paragraphs)
|
||||
local index = help.indexOf[section.id]
|
||||
for _, child in ipairs(ADHelp.children(help.sections, index)) do
|
||||
local id = child.id
|
||||
self:addLinkRow(" → " .. child.title, function(frame) frame:openHelpView({mode = "section", id = id}) end)
|
||||
end
|
||||
local nextSection = help.sections[(index or 0) + 1]
|
||||
if nextSection ~= nil then
|
||||
local id = nextSection.id
|
||||
self:addLinkRow(string.format(i18n:getText("spu_help_next"), nextSection.title), function(frame) frame:openHelpView({mode = "section", id = id}) end)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- indholdsfortegnelsen: alle afsnit som links
|
||||
self:addLinkRow(i18n:getText("spu_help_searchLink"), function(frame) frame:onClickHelpSearch() end)
|
||||
for _, section in ipairs(help.sections) do
|
||||
local id = section.id
|
||||
self:addLinkRow((INDENT[section.level] or "") .. section.title, function(frame) frame:openHelpView({mode = "section", id = id}) end)
|
||||
end
|
||||
end
|
||||
self:addLinkRow(i18n:getText("spu_help_backLink"), function(frame) frame:helpBack() end)
|
||||
end
|
||||
|
||||
-- ---- krogene ----
|
||||
|
||||
local baseRebuild = SmartPickupFrame.rebuild
|
||||
function SmartPickupFrame:rebuild()
|
||||
if self.helpView ~= nil and not self.editPanelOpen then
|
||||
self:clearRows()
|
||||
self:setStaticRowsVisible(self.currentTab, nil)
|
||||
self:fillHelpRows()
|
||||
self:colorRows()
|
||||
self.boxLayout:invalidateLayout()
|
||||
self:restoreFocusIfLost()
|
||||
self:refreshButtons()
|
||||
return
|
||||
end
|
||||
baseRebuild(self)
|
||||
self:decorateHelpRows(self.clonedRows)
|
||||
end
|
||||
|
||||
local baseFillEditPanel = SmartPickupFrame.fillEditPanel
|
||||
function SmartPickupFrame:fillEditPanel(adEnv)
|
||||
if self.helpView ~= nil and self:editPanelHooks() ~= nil then
|
||||
self:clearPanelRows()
|
||||
self:layoutEditPanel()
|
||||
self:withRowTarget(self.editLayout, function(frame) frame:fillHelpRows() end)
|
||||
self:colorLayout(self.editLayout)
|
||||
self.editLayout:invalidateLayout()
|
||||
return
|
||||
end
|
||||
baseFillEditPanel(self, adEnv)
|
||||
self:decorateHelpRows(self.panelRows)
|
||||
end
|
||||
|
||||
-- mens hjælpen er åben: ingen tidsstyret genopbygning (rullepositionen bevares)
|
||||
local baseRefreshLive = SmartPickupFrame.refreshLive
|
||||
function SmartPickupFrame:refreshLive()
|
||||
if self.helpView ~= nil then
|
||||
if self.editPanelOpen then self:layoutEditPanel() end
|
||||
self:refreshButtons()
|
||||
return
|
||||
end
|
||||
baseRefreshLive(self)
|
||||
end
|
||||
|
||||
local baseRefreshButtons = SmartPickupFrame.refreshButtons
|
||||
function SmartPickupFrame:refreshButtons()
|
||||
if self.helpView ~= nil then
|
||||
if self.menuButtonInfo ~= self.helpViewButtons then
|
||||
self.menuButtonInfo = self.helpViewButtons
|
||||
self:setMenuButtonInfo(self.helpViewButtons)
|
||||
end
|
||||
if self.setMenuButtonInfoDirty ~= nil then self:setMenuButtonInfoDirty() end
|
||||
return
|
||||
end
|
||||
baseRefreshButtons(self)
|
||||
end
|
||||
|
||||
-- ESC i hjælpen: et skridt tilbage (ikke luk menuen/vinduet — review 20/10)
|
||||
local baseRequestClose = SmartPickupFrame.requestClose
|
||||
function SmartPickupFrame:requestClose(callback)
|
||||
if self.helpView ~= nil then
|
||||
self:helpBack()
|
||||
return false
|
||||
end
|
||||
return baseRequestClose(self, callback)
|
||||
end
|
||||
|
||||
for _, name in ipairs({"switchTab", "onFrameClose", "openEditPanel", "hideEditPanel"}) do
|
||||
local base = SmartPickupFrame[name]
|
||||
SmartPickupFrame[name] = function(self, ...)
|
||||
self:closeHelp()
|
||||
return base(self, ...)
|
||||
end
|
||||
end
|
||||
@@ -116,6 +116,10 @@ function SmartPickupFrame:fillSettingsRows(adEnv)
|
||||
self:addTextRow("ADSettings mangler")
|
||||
return
|
||||
end
|
||||
-- hele manualen med søgning (brugerønske 20/10)
|
||||
if self.openHelpView ~= nil then
|
||||
self:addLinkRow(self.i18n:getText("spu_help_openManual"), function(frame) frame:openHelpView({mode = "toc"}) end)
|
||||
end
|
||||
local section = self:getSettingsSection()
|
||||
self:addSettingsSectionRow(section)
|
||||
local keys = ADSettings.sectionKeys(section)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -588,6 +588,19 @@
|
||||
<text name="spu_guide_flow_lockSet" text="Lås traktor og vogn til flowet"/>
|
||||
<text name="spu_guide_flow_lockSet_tooltip" text="Ja: flowets traktor og vogn lånes aldrig ud (maskinpulje, markarbejde, marksiloer, andre flows) og køres ikke hjem til gården — heller ikke når flowet sover eller stoppes. Sættet holder ved sit Wait-punkt. Til områder langt fra gården."/>
|
||||
<text name="spu_guide_flow_sumLocked" text="låst"/>
|
||||
<text name="spu_help_button" text="Hjælp"/>
|
||||
<text name="spu_help_back" text="Tilbage"/>
|
||||
<text name="spu_help_search" text="Søg"/>
|
||||
<text name="spu_help_toc" text="Indhold"/>
|
||||
<text name="spu_help_title" text="— Manual —"/>
|
||||
<text name="spu_help_missing" text="Hjælpen kunne ikke indlæses (help/help_da.xml mangler)."/>
|
||||
<text name="spu_help_results" text='Søgning: "%s" — %d afsnit'/>
|
||||
<text name="spu_help_whole" text=" → Hele afsnittet: %s"/>
|
||||
<text name="spu_help_next" text=" Næste: %s"/>
|
||||
<text name="spu_help_searchLink" text=" Søg i manualen …"/>
|
||||
<text name="spu_help_backLink" text=" ← Tilbage"/>
|
||||
<text name="spu_help_searchTitle" text="Søg i manualen"/>
|
||||
<text name="spu_help_openManual" text="Manual: læs og søg (?)"/>
|
||||
<text name="spu_guide_flow_noTractors" text=" Ingen ledige traktorer"/>
|
||||
<text name="spu_guide_flow_otherFlows" text=" %d traktorer kører i andre flows og vises ikke"/>
|
||||
<text name="spu_guide_flow_blockedShow" text=" %d traktorer kan ikke bruges her (vognen passer ikke) — klik for at se hvorfor"/>
|
||||
|
||||
@@ -588,6 +588,19 @@
|
||||
<text name="spu_guide_flow_lockSet" text="Lock tractor and trailer to the flow"/>
|
||||
<text name="spu_guide_flow_lockSet_tooltip" text="Yes: the flow's tractor and trailer are never lent out (machine pool, field work, field silos, other flows) and never driven home to the farm — not even while the flow sleeps or is stopped. The set waits at its Wait point. For areas far from the farm."/>
|
||||
<text name="spu_guide_flow_sumLocked" text="locked"/>
|
||||
<text name="spu_help_button" text="Help"/>
|
||||
<text name="spu_help_back" text="Back"/>
|
||||
<text name="spu_help_search" text="Search"/>
|
||||
<text name="spu_help_toc" text="Contents"/>
|
||||
<text name="spu_help_title" text="— Manual —"/>
|
||||
<text name="spu_help_missing" text="The help could not be loaded (help/help_en.xml is missing)."/>
|
||||
<text name="spu_help_results" text='Search: "%s" — %d sections'/>
|
||||
<text name="spu_help_whole" text=" → Whole section: %s"/>
|
||||
<text name="spu_help_next" text=" Next: %s"/>
|
||||
<text name="spu_help_searchLink" text=" Search the manual …"/>
|
||||
<text name="spu_help_backLink" text=" ← Back"/>
|
||||
<text name="spu_help_searchTitle" text="Search the manual"/>
|
||||
<text name="spu_help_openManual" text="Manual: read and search (?)"/>
|
||||
<text name="spu_guide_flow_noTractors" text=" No free tractors"/>
|
||||
<text name="spu_guide_flow_otherFlows" text=" %d tractors run in other flows and are hidden"/>
|
||||
<text name="spu_guide_flow_blockedShow" text=" %d tractors cannot be used here (trailer does not fit) — click to see why"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.62.398.0</version>
|
||||
<version>1.62.399.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
@@ -62,6 +62,7 @@
|
||||
<sourceFile filename="adFieldRefill.lua"/>
|
||||
<sourceFile filename="adFieldFertilizer.lua"/>
|
||||
<sourceFile filename="adFillFold.lua"/>
|
||||
<sourceFile filename="adHelp.lua"/>
|
||||
<sourceFile filename="adPlayerTransport.lua"/>
|
||||
<sourceFile filename="adFieldSiloPlanner.lua"/>
|
||||
<sourceFile filename="adFieldSiloConfig.lua"/>
|
||||
|
||||
Reference in New Issue
Block a user