feat/redesign #1
2 changed files with 34 additions and 24 deletions
58
UI.lua
58
UI.lua
|
|
@ -6,12 +6,16 @@
|
||||||
AltSystem = AltSystem or {}
|
AltSystem = AltSystem or {}
|
||||||
|
|
||||||
local WINDOW_WIDTH = 700
|
local WINDOW_WIDTH = 700
|
||||||
local WINDOW_HEIGHT = 500
|
local WINDOW_HEIGHT = 520
|
||||||
local CONTROLS_WIDTH = 350
|
local CONTROLS_WIDTH = 360
|
||||||
local LOG_WIDTH = 350
|
local LOG_WIDTH = 340
|
||||||
local PADDING = 12
|
local PADDING = 12
|
||||||
|
local PADDING_HEADER = 6
|
||||||
local ROW_HEIGHT = 26
|
local ROW_HEIGHT = 26
|
||||||
local SECTION_GAP = 10
|
local LABEL_HEIGHT = 14 -- approximate height of GameFontNormal text
|
||||||
|
local LABEL_GAP = 4 -- gap between a sub-label and its input
|
||||||
|
local ITEM_GAP = 10 -- gap between inputs within the same section
|
||||||
|
local SECTION_GAP = 22 -- gap between major sections
|
||||||
|
|
||||||
-- Helper: Build the skill option list from current AltSystem.Data.Skills
|
-- Helper: Build the skill option list from current AltSystem.Data.Skills
|
||||||
local function BuildSkillOptions()
|
local function BuildSkillOptions()
|
||||||
|
|
@ -29,26 +33,32 @@ local function BuildSkillOptions()
|
||||||
return options
|
return options
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Helper: Create a flat dark dropdown with optional label (reuses shared CreateFlatDropdown)
|
-- Helper: Create a flat dark dropdown with label on top (reuses shared CreateFlatDropdown)
|
||||||
local function CreateDropdown(parent, name, labelText, options, defaultIndex, onSelect, labelFont)
|
local function CreateDropdown(parent, name, labelText, options, defaultIndex, onSelect, labelFont)
|
||||||
|
local hasLabel = labelText and labelText ~= ""
|
||||||
|
local containerHeight = hasLabel and (LABEL_HEIGHT + LABEL_GAP + 28) or ROW_HEIGHT
|
||||||
|
|
||||||
local container = CreateFrame("Frame", nil, parent)
|
local container = CreateFrame("Frame", nil, parent)
|
||||||
container:SetHeight(ROW_HEIGHT)
|
container:SetHeight(containerHeight)
|
||||||
|
|
||||||
local label
|
local label
|
||||||
if labelText and labelText ~= "" then
|
if hasLabel then
|
||||||
label = container:CreateFontString(nil, "OVERLAY", labelFont or "GameFontNormal")
|
label = container:CreateFontString(nil, "OVERLAY", labelFont or "GameFontNormal")
|
||||||
label:SetPoint("LEFT", container, "LEFT", 0, 0)
|
label:SetPoint("TOPLEFT", container, "TOPLEFT", 0, 0)
|
||||||
label:SetText(labelText)
|
label:SetText(labelText)
|
||||||
label:SetJustifyH("LEFT")
|
label:SetJustifyH("LEFT")
|
||||||
|
label:SetTextColor(0.9, 0.75, 0.2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local selectedIndex = defaultIndex or 1
|
local selectedIndex = defaultIndex or 1
|
||||||
|
|
||||||
local dropdown = AltSystem.CreateFlatDropdown(name, container, 190)
|
local dropdown = AltSystem.CreateFlatDropdown(name, container, 190)
|
||||||
if label then
|
if hasLabel then
|
||||||
dropdown:SetPoint("RIGHT", container, "RIGHT", 0, 0)
|
dropdown:SetPoint("TOPLEFT", container, "TOPLEFT", 0, -(LABEL_HEIGHT + LABEL_GAP))
|
||||||
|
dropdown:SetPoint("TOPRIGHT", container, "TOPRIGHT", 0, -(LABEL_HEIGHT + LABEL_GAP))
|
||||||
else
|
else
|
||||||
dropdown:SetPoint("LEFT", container, "LEFT", 0, 0)
|
dropdown:SetPoint("LEFT", container, "LEFT", 0, 0)
|
||||||
|
dropdown:SetPoint("RIGHT", container, "RIGHT", 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set initial label text
|
-- Set initial label text
|
||||||
|
|
@ -260,12 +270,12 @@ function AltSystem:CreateMainFrame()
|
||||||
local yPos = -PADDING
|
local yPos = -PADDING
|
||||||
|
|
||||||
-- Section: Define Your Base Roll
|
-- Section: Define Your Base Roll
|
||||||
CreateSectionHeader(content, "Define Your Base Roll", PADDING, yPos)
|
CreateSectionHeader(content, "Base Roll", PADDING_HEADER, yPos)
|
||||||
yPos = yPos - 25
|
yPos = yPos - 26
|
||||||
|
|
||||||
-- Roll Type label
|
-- Roll Type label
|
||||||
CreateSubLabel(content, "Roll Type", PADDING, yPos)
|
CreateSubLabel(content, "Roll Type", PADDING, yPos)
|
||||||
yPos = yPos - 20
|
yPos = yPos - (LABEL_HEIGHT + LABEL_GAP)
|
||||||
|
|
||||||
-- Roll Type radio buttons
|
-- Roll Type radio buttons
|
||||||
local attackRadio, defenseRadio
|
local attackRadio, defenseRadio
|
||||||
|
|
@ -295,7 +305,7 @@ function AltSystem:CreateMainFrame()
|
||||||
UpdateRollTypeSelection("defense")
|
UpdateRollTypeSelection("defense")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
yPos = yPos - ROW_HEIGHT - SECTION_GAP
|
yPos = yPos - ROW_HEIGHT - ITEM_GAP
|
||||||
|
|
||||||
-- Skill dropdown
|
-- Skill dropdown
|
||||||
local skillOptions = BuildSkillOptions()
|
local skillOptions = BuildSkillOptions()
|
||||||
|
|
@ -351,11 +361,11 @@ function AltSystem:CreateMainFrame()
|
||||||
AltSystem.SetSkillIndex = setSkillIndex
|
AltSystem.SetSkillIndex = setSkillIndex
|
||||||
AltSystem.UpdateSkillWarning = UpdateSkillWarning
|
AltSystem.UpdateSkillWarning = UpdateSkillWarning
|
||||||
|
|
||||||
yPos = yPos - ROW_HEIGHT - SECTION_GAP
|
yPos = yPos - (LABEL_HEIGHT + LABEL_GAP + 28) - ITEM_GAP
|
||||||
|
|
||||||
-- Armor label
|
-- Armor label
|
||||||
CreateSubLabel(content, "Extra Armor", PADDING, yPos)
|
CreateSubLabel(content, "Extra Armor", PADDING, yPos)
|
||||||
yPos = yPos - 20
|
yPos = yPos - (LABEL_HEIGHT + LABEL_GAP)
|
||||||
|
|
||||||
-- Armor radio buttons
|
-- Armor radio buttons
|
||||||
local armorRadios = {}
|
local armorRadios = {}
|
||||||
|
|
@ -386,8 +396,8 @@ function AltSystem:CreateMainFrame()
|
||||||
yPos = yPos - ROW_HEIGHT - SECTION_GAP
|
yPos = yPos - ROW_HEIGHT - SECTION_GAP
|
||||||
|
|
||||||
-- Section: Modifiers (optional)
|
-- Section: Modifiers (optional)
|
||||||
CreateSectionHeader(content, "Modifiers (optional)", PADDING, yPos)
|
CreateSectionHeader(content, "Modifiers (optional)", PADDING_HEADER, yPos)
|
||||||
yPos = yPos - 28
|
yPos = yPos - 26
|
||||||
--CreateSubLabel(content, "Label", PADDING, yPos)
|
--CreateSubLabel(content, "Label", PADDING, yPos)
|
||||||
--yPos = yPos - 22
|
--yPos = yPos - 22
|
||||||
|
|
||||||
|
|
@ -463,11 +473,11 @@ function AltSystem:CreateMainFrame()
|
||||||
UpdatePetVisual()
|
UpdatePetVisual()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
yPos = yPos - ROW_HEIGHT - SECTION_GAP
|
yPos = yPos - ROW_HEIGHT - ITEM_GAP
|
||||||
|
|
||||||
-- Item label
|
-- Item label
|
||||||
CreateSubLabel(content, "Item", PADDING, yPos)
|
CreateSubLabel(content, "Item", PADDING, yPos)
|
||||||
yPos = yPos - 20
|
yPos = yPos - (LABEL_HEIGHT + LABEL_GAP)
|
||||||
|
|
||||||
-- Item radio buttons
|
-- Item radio buttons
|
||||||
local itemRadios = {}
|
local itemRadios = {}
|
||||||
|
|
@ -498,8 +508,8 @@ function AltSystem:CreateMainFrame()
|
||||||
yPos = yPos - ROW_HEIGHT - SECTION_GAP
|
yPos = yPos - ROW_HEIGHT - SECTION_GAP
|
||||||
|
|
||||||
-- Section: Roll Dice
|
-- Section: Roll Dice
|
||||||
CreateSectionHeader(content, "Roll Dice", PADDING, yPos)
|
CreateSectionHeader(content, "Roll Mode", PADDING_HEADER, yPos)
|
||||||
yPos = yPos - 22
|
yPos = yPos - 26
|
||||||
|
|
||||||
-- Announce Roll dropdown (Self Roll + channels)
|
-- Announce Roll dropdown (Self Roll + channels)
|
||||||
local announceOptions = { { text = "Self Roll" } }
|
local announceOptions = { { text = "Self Roll" } }
|
||||||
|
|
@ -524,7 +534,7 @@ function AltSystem:CreateMainFrame()
|
||||||
announceContainer:SetPoint("TOPLEFT", content, "TOPLEFT", PADDING, yPos)
|
announceContainer:SetPoint("TOPLEFT", content, "TOPLEFT", PADDING, yPos)
|
||||||
announceContainer:SetWidth(CONTROLS_WIDTH - PADDING * 2)
|
announceContainer:SetWidth(CONTROLS_WIDTH - PADDING * 2)
|
||||||
|
|
||||||
yPos = yPos - ROW_HEIGHT - SECTION_GAP
|
yPos = yPos - (LABEL_HEIGHT + LABEL_GAP + 28) - ITEM_GAP
|
||||||
|
|
||||||
-- Roll button
|
-- Roll button
|
||||||
local rollLabel = AltSystem.State.rollType == "attack" and "Roll Attack" or "Roll Defense"
|
local rollLabel = AltSystem.State.rollType == "attack" and "Roll Attack" or "Roll Defense"
|
||||||
|
|
@ -545,7 +555,7 @@ function AltSystem:CreateMainFrame()
|
||||||
logPanel:SetSize(LOG_WIDTH, tabContentHeight)
|
logPanel:SetSize(LOG_WIDTH, tabContentHeight)
|
||||||
|
|
||||||
-- Log header
|
-- Log header
|
||||||
local logHeader = CreateSectionHeader(logPanel, "Log", PADDING, -PADDING)
|
local logHeader = CreateSectionHeader(logPanel, "Log", 0, -PADDING)
|
||||||
|
|
||||||
-- Log scroll area background
|
-- Log scroll area background
|
||||||
local logBg = CreateFrame("Frame", nil, logPanel, "InsetFrameTemplate")
|
local logBg = CreateFrame("Frame", nil, logPanel, "InsetFrameTemplate")
|
||||||
|
|
|
||||||
BIN
docs/roll_tab_design.png
Executable file → Normal file
BIN
docs/roll_tab_design.png
Executable file → Normal file
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
Loading…
Add table
Add a link
Reference in a new issue