diff --git a/UI.lua b/UI.lua index 4412ec0..0b989bb 100644 --- a/UI.lua +++ b/UI.lua @@ -50,7 +50,7 @@ local function CreateDropdown(parent, name, labelText, options, defaultIndex, on else dropdown:SetPoint("LEFT", container, "LEFT", 0, 0) end - dropdown:SetWidth(180) + dropdown:SetWidth(190) dropdown:SetupMenu(function(dropdown, rootDescription) for i, option in ipairs(options) do @@ -343,6 +343,37 @@ function AltSystem:CreateMainFrame() yPos = yPos - ROW_HEIGHT - SECTION_GAP + -- Item label + CreateSubLabel(content, "Item", PADDING, yPos) + yPos = yPos - 20 + + -- Item radio buttons + local itemRadios = {} + + local function UpdateItemSelection(index) + AltSystem.State.selectedItemIndex = index + for i, radio in ipairs(itemRadios) do + radio:SetChecked(i == index) + end + end + + local itemX = PADDING + for i, item in ipairs(AltSystem.Data.Items) do + local text = item.name + if item.modifier > 0 then + text = text .. " (+" .. item.modifier .. ")" + end + local radio = CreateRadioButton(content, "AltSystemItemRadio" .. i, text, itemX, yPos, + AltSystem.State.selectedItemIndex == i, + function() + UpdateItemSelection(i) + end) + table.insert(itemRadios, radio) + itemX = itemX + 110 + end + + yPos = yPos - ROW_HEIGHT - SECTION_GAP + -- Section: Modifiers (optional) CreateSectionHeader(content, "Modifiers (optional)", PADDING, yPos) yPos = yPos - 18