mirror of
https://github.com/Lacustat/Freewood-OctoWoW-Core.git
synced 2026-10-31 04:17:04 +00:00
0.1.177: Gegner-Tooltip mit weiteren Beutewert-Zeilen, einzeln schaltbar
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
f9583c0303
commit
3fb4ec5358
+27
-3
@@ -57,11 +57,14 @@ end
|
||||
|
||||
function T.RegisterOption(key, labelKey, def)
|
||||
def = def or {}
|
||||
if defaults[key] == nil then defaults[key] = def.default ~= false end
|
||||
if defaults[key] == nil then
|
||||
if type(def.default) == "number" then defaults[key] = def.default else defaults[key] = def.default ~= false end
|
||||
end
|
||||
for _, o in ipairs(options) do
|
||||
if o.key == key then return end
|
||||
end
|
||||
options[#options + 1] = { key = key, label = labelKey, order = def.order or 100, available = def.available }
|
||||
options[#options + 1] = { key = key, label = labelKey, order = def.order or 100, available = def.available,
|
||||
min = def.min, max = def.max, step = def.step }
|
||||
table.sort(options, function(a, b)
|
||||
if a.order ~= b.order then return a.order < b.order end
|
||||
return a.key < b.key
|
||||
@@ -177,13 +180,34 @@ if UI and UI.RegisterSettingsSection then
|
||||
boxes[#boxes + 1] = cb
|
||||
return cb
|
||||
end
|
||||
local function Slider(o)
|
||||
local text = FW.L[o.label] or o.label
|
||||
local val = UI.CreateLabel(f, "", { size = 12 })
|
||||
stack:Add(val, { fit = true, gap = 6 })
|
||||
local key = o.key
|
||||
local sl = UI.CreateSlider(f, 200, {
|
||||
min = o.min, max = o.max, step = o.step or 1,
|
||||
get = function() return tonumber(T.Get(key)) or o.min end,
|
||||
set = function(v)
|
||||
T.Set(key, v)
|
||||
val:SetText(string.format(text, v))
|
||||
end,
|
||||
})
|
||||
sl.onText = function(v) val:SetText(string.format(text, v)) end
|
||||
stack:Add(sl, { height = 20, gap = 4 })
|
||||
boxes[#boxes + 1] = sl
|
||||
end
|
||||
Box("tipSkin", L.TIPSET_SKIN)
|
||||
Box("tipCursor", L.TIPSET_CURSOR)
|
||||
function f.Refresh()
|
||||
for _, o in ipairs(options) do
|
||||
if not made[o.key] and (not o.available or o.available()) then
|
||||
made[o.key] = true
|
||||
Box(o.key, FW.L[o.label] or o.label)
|
||||
if o.max then
|
||||
Slider(o)
|
||||
else
|
||||
Box(o.key, FW.L[o.label] or o.label)
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, cb in ipairs(boxes) do cb:Refresh() end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Notes: Base addon of the Freewood family: data storage, UI kit, export/import and the main window.
|
||||
## Notes-deDE: Basis-Addon der Freewood-Familie: Datenspeicher, UI-Bausteine, Export/Import und Hauptfenster.
|
||||
## Author: Lacustat
|
||||
## Version: 0.1.176
|
||||
## Version: 0.1.177
|
||||
## SavedVariables: FreewoodDB
|
||||
## SavedVariablesPerCharacter: FreewoodCharDB
|
||||
|
||||
|
||||
@@ -360,8 +360,11 @@ local function DoLayout()
|
||||
frame:Show()
|
||||
frame:ClearAllPoints()
|
||||
frame:SetPoint("TOPLEFT", settingsBody, "TOPLEFT", xs[best], def.y)
|
||||
local wChanged = frame.laidW ~= colW
|
||||
frame.laidW = colW
|
||||
frame:SetWidth(colW)
|
||||
frame:SetHeight(h)
|
||||
if wChanged and frame.stack and frame.stack.Layout then pcall(frame.stack.Layout, frame.stack) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user