feat/redesign #1
2 changed files with 36 additions and 24 deletions
|
|
@ -44,8 +44,9 @@ local function CreateFlatEditBox(name, parent, width)
|
|||
end
|
||||
|
||||
-- ─── Helper: Create a flat dark dropdown button matching the blocky design ──
|
||||
-- Shared globally so other files (UI.lua) can reuse it.
|
||||
|
||||
local function CreateFlatDropdown(name, parent, width)
|
||||
function AltSystem.CreateFlatDropdown(name, parent, width)
|
||||
local btn = CreateFrame("Button", name, parent, "BackdropTemplate")
|
||||
btn:SetSize(width, 28)
|
||||
btn:SetBackdrop({
|
||||
|
|
@ -107,12 +108,12 @@ local function CreateSkillRowFrame(index)
|
|||
row.nameContainer = nameContainer
|
||||
|
||||
-- Level Dropdown (flat dark style)
|
||||
local levelDropdown = CreateFlatDropdown("AltSystemSkillLevel" .. index, row, LEVEL_WIDTH)
|
||||
local levelDropdown = AltSystem.CreateFlatDropdown("AltSystemSkillLevel" .. index, row, LEVEL_WIDTH)
|
||||
levelDropdown:SetPoint("LEFT", nameContainer, "RIGHT", 12, 0)
|
||||
row.levelDropdown = levelDropdown
|
||||
|
||||
-- Value Dropdown (flat dark style)
|
||||
local valueDropdown = CreateFlatDropdown("AltSystemSkillValue" .. index, row, VALUE_WIDTH)
|
||||
local valueDropdown = AltSystem.CreateFlatDropdown("AltSystemSkillValue" .. index, row, VALUE_WIDTH)
|
||||
valueDropdown:SetPoint("LEFT", levelDropdown, "RIGHT", 8, 0)
|
||||
row.valueDropdown = valueDropdown
|
||||
|
||||
|
|
|
|||
53
UI.lua
53
UI.lua
|
|
@ -29,7 +29,7 @@ local function BuildSkillOptions()
|
|||
return options
|
||||
end
|
||||
|
||||
-- Helper: Create a modern dropdown (WowStyle1DropdownTemplate)
|
||||
-- Helper: Create a flat dark dropdown with optional label (reuses shared CreateFlatDropdown)
|
||||
local function CreateDropdown(parent, name, labelText, options, defaultIndex, onSelect, labelFont)
|
||||
local container = CreateFrame("Frame", nil, parent)
|
||||
container:SetHeight(ROW_HEIGHT)
|
||||
|
|
@ -44,28 +44,32 @@ local function CreateDropdown(parent, name, labelText, options, defaultIndex, on
|
|||
|
||||
local selectedIndex = defaultIndex or 1
|
||||
|
||||
local dropdown = CreateFrame("DropdownButton", name, container, "WowStyle1DropdownTemplate")
|
||||
local dropdown = AltSystem.CreateFlatDropdown(name, container, 190)
|
||||
if label then
|
||||
dropdown:SetPoint("RIGHT", container, "RIGHT", 0, 0)
|
||||
else
|
||||
dropdown:SetPoint("LEFT", container, "LEFT", 0, 0)
|
||||
end
|
||||
dropdown:SetWidth(190)
|
||||
|
||||
dropdown:SetupMenu(function(dropdown, rootDescription)
|
||||
-- Set initial label text
|
||||
if options[selectedIndex] then
|
||||
dropdown.label:SetText(options[selectedIndex].text)
|
||||
end
|
||||
|
||||
dropdown:SetupMenu(function(owner, rootDescription)
|
||||
for i, option in ipairs(options) do
|
||||
rootDescription:CreateRadio(
|
||||
option.text,
|
||||
function(data)
|
||||
return data == selectedIndex
|
||||
function()
|
||||
return i == selectedIndex
|
||||
end,
|
||||
function(data)
|
||||
selectedIndex = data
|
||||
function()
|
||||
selectedIndex = i
|
||||
dropdown.label:SetText(option.text)
|
||||
if onSelect then
|
||||
onSelect(data, options[data])
|
||||
onSelect(i, option)
|
||||
end
|
||||
end,
|
||||
i
|
||||
end
|
||||
)
|
||||
end
|
||||
end)
|
||||
|
|
@ -74,6 +78,9 @@ local function CreateDropdown(parent, name, labelText, options, defaultIndex, on
|
|||
return selectedIndex
|
||||
end, function(idx)
|
||||
selectedIndex = idx
|
||||
if options[idx] then
|
||||
dropdown.label:SetText(options[idx].text)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -573,24 +580,28 @@ function AltSystem:RefreshSkillDropdown()
|
|||
-- Rebuild the dropdown menu with the new skill list
|
||||
if AltSystem.SkillDropdown then
|
||||
local skillOptions = BuildSkillOptions()
|
||||
AltSystem.SkillDropdown:SetupMenu(function(dropdown, rootDescription)
|
||||
-- Update the displayed label text
|
||||
if skillOptions[newIndex] then
|
||||
AltSystem.SkillDropdown.label:SetText(skillOptions[newIndex].text)
|
||||
end
|
||||
AltSystem.SkillDropdown:SetupMenu(function(owner, rootDescription)
|
||||
for i, option in ipairs(skillOptions) do
|
||||
rootDescription:CreateRadio(
|
||||
option.text,
|
||||
function(data)
|
||||
return data == AltSystem.State.selectedSkillIndex
|
||||
function()
|
||||
return i == AltSystem.State.selectedSkillIndex
|
||||
end,
|
||||
function(data)
|
||||
AltSystem.State.selectedSkillIndex = data
|
||||
AltSystem.State.selectedSkillName = AltSystem.Data.Skills[data] and AltSystem.Data.Skills[data].name or nil
|
||||
function()
|
||||
AltSystem.State.selectedSkillIndex = i
|
||||
AltSystem.State.selectedSkillName = AltSystem.Data.Skills[i] and AltSystem.Data.Skills[i].name or nil
|
||||
AltSystem.SkillDropdown.label:SetText(option.text)
|
||||
if AltSystem.SetSkillIndex then
|
||||
AltSystem.SetSkillIndex(data)
|
||||
AltSystem.SetSkillIndex(i)
|
||||
end
|
||||
if AltSystem.UpdateSkillWarning then
|
||||
AltSystem.UpdateSkillWarning(data)
|
||||
AltSystem.UpdateSkillWarning(i)
|
||||
end
|
||||
end,
|
||||
i
|
||||
end
|
||||
)
|
||||
end
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue