Add files via upload
This commit is contained in:
@@ -35,7 +35,7 @@ local C = {
|
||||
|
||||
-- Layout
|
||||
local GUI_WIDTH = 320
|
||||
local GUI_HEIGHT = 480
|
||||
local GUI_HEIGHT = 520
|
||||
local HEADER_H = 30
|
||||
local MARGIN = 14
|
||||
local FONT_NORMAL = "Fonts\\FRIZQT__.TTF"
|
||||
@@ -428,6 +428,80 @@ function addon.GUI:BuildSettings(parent)
|
||||
widgets[configKey] = slider
|
||||
end
|
||||
|
||||
-- ==============================================================
|
||||
-- Helper: Dropdown (uses Blizzard's UIDropDownMenuTemplate)
|
||||
-- ==============================================================
|
||||
local function Dropdown(labelText, configKey, options)
|
||||
local label = parent:CreateFontString(nil, "OVERLAY")
|
||||
label:SetFont(FONT_NORMAL, FONT_SIZE)
|
||||
label:SetPoint("TOPLEFT", parent, "TOPLEFT", MARGIN, -y)
|
||||
label:SetTextColor(unpack(C.TEXT))
|
||||
label:SetText(labelText)
|
||||
y = y + 16
|
||||
|
||||
local dd = CreateFrame("Frame", "RelationshipsThreatPlatesDD_" .. configKey, parent, "UIDropDownMenuTemplate")
|
||||
dd:SetPoint("TOPLEFT", parent, "TOPLEFT", MARGIN - 14, -y)
|
||||
UIDropDownMenu_SetWidth(160, dd)
|
||||
|
||||
local function GetLabelFor(val)
|
||||
for i = 1, table.getn(options) do
|
||||
if options[i].value == val then return options[i].label end
|
||||
end
|
||||
return tostring(val)
|
||||
end
|
||||
|
||||
UIDropDownMenu_Initialize(dd, function()
|
||||
for i = 1, table.getn(options) do
|
||||
local opt = options[i]
|
||||
local info = {}
|
||||
info.text = opt.label
|
||||
info.value = opt.value
|
||||
info.func = function()
|
||||
RelationshipsThreatPlatesDB[configKey] = this.value
|
||||
UIDropDownMenu_SetSelectedValue(dd, this.value)
|
||||
UIDropDownMenu_SetText(GetLabelFor(this.value), dd)
|
||||
ApplySettingChange(configKey)
|
||||
end
|
||||
info.checked = (RelationshipsThreatPlatesDB[configKey] == opt.value)
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
end)
|
||||
UIDropDownMenu_SetSelectedValue(dd, RelationshipsThreatPlatesDB[configKey])
|
||||
UIDropDownMenu_SetText(GetLabelFor(RelationshipsThreatPlatesDB[configKey]), dd)
|
||||
|
||||
y = y + 34
|
||||
widgets[configKey] = dd
|
||||
end
|
||||
|
||||
-- ==============================================================
|
||||
-- Helper: small action button
|
||||
-- ==============================================================
|
||||
local function ActionButton(labelText, onClick)
|
||||
local btn = CreateFrame("Button", nil, parent)
|
||||
btn:SetWidth(W - MARGIN * 2)
|
||||
btn:SetHeight(20)
|
||||
btn:SetPoint("TOPLEFT", parent, "TOPLEFT", MARGIN, -y)
|
||||
SafeSetBackdrop(btn, {
|
||||
bgFile = C.SOLID,
|
||||
edgeFile = C.SOLID,
|
||||
tile = false, tileSize = 0,
|
||||
edgeSize = 1,
|
||||
})
|
||||
btn:SetBackdropColor(unpack(C.BUTTON_BG))
|
||||
btn:SetBackdropBorderColor(unpack(C.BORDER))
|
||||
local t = btn:CreateFontString(nil, "OVERLAY")
|
||||
t:SetFont(FONT_NORMAL, FONT_SIZE, "OUTLINE")
|
||||
t:SetPoint("CENTER", btn, "CENTER", 0, 0)
|
||||
t:SetTextColor(unpack(C.BUTTON_TEXT))
|
||||
t:SetText(labelText)
|
||||
btn:SetFontString(t)
|
||||
btn:SetScript("OnEnter", function() this:SetBackdropColor(unpack(C.BUTTON_HOVER)) end)
|
||||
btn:SetScript("OnLeave", function() this:SetBackdropColor(unpack(C.BUTTON_BG)) end)
|
||||
btn:SetScript("OnClick", onClick)
|
||||
y = y + 24
|
||||
return btn
|
||||
end
|
||||
|
||||
-- ==============================================================
|
||||
-- GENERAL SECTION
|
||||
-- ==============================================================
|
||||
@@ -469,6 +543,57 @@ function addon.GUI:BuildSettings(parent)
|
||||
CheckBox("Show on Neutral", "showOnNeutral", "Show threat bars on neutral units")
|
||||
CheckBox("Show on Friendly", "showOnFriendly", "Show threat bars on friendly units")
|
||||
|
||||
-- ==============================================================
|
||||
-- BEHAVIOR SECTION (2.6)
|
||||
-- ==============================================================
|
||||
SectionLabel("Behavior")
|
||||
CheckBox("Combat Only", "combatOnly", "Only show bars while you are in combat")
|
||||
Slider("Hide Below %", "hideBelowPct", 0, 90, 5, "%")
|
||||
Dropdown("Text Format", "textFormat", {
|
||||
{ label = "Percent (85%)", value = "percent" },
|
||||
{ label = "Tank Lead (+123)", value = "tank" },
|
||||
{ label = "Status (SAFE/PULL!)", value = "status" },
|
||||
{ label = "Combo (85% +123)", value = "combo" },
|
||||
})
|
||||
Dropdown("Colour Preset", "colorPreset", {
|
||||
{ label = "Kui (green -> red)", value = "kui" },
|
||||
{ label = "Cool (blue -> red)", value = "cool" },
|
||||
{ label = "Mono (grey -> red)", value = "mono" },
|
||||
{ label = "Warband (cyan -> red)", value = "warband" },
|
||||
})
|
||||
|
||||
-- ==============================================================
|
||||
-- WARNINGS SECTION (2.6)
|
||||
-- ==============================================================
|
||||
SectionLabel("Warnings")
|
||||
CheckBox("Flash Bar on Aggro", "flashOnAggro", "Pulse the bar when you have 100% aggro")
|
||||
Slider("Flash Speed", "flashSpeed", 1, 10, 1, "")
|
||||
CheckBox("Play Warning Sound", "warningSound", "Sound when threat crosses the threshold")
|
||||
Slider("Warning Threshold", "warningThreshold", 40, 100, 5, "%")
|
||||
Dropdown("Warning Sound", "warningSoundName", {
|
||||
{ label = "Raid Warning", value = "RaidWarning" },
|
||||
{ label = "Tell Message", value = "TellMessage" },
|
||||
{ label = "Murloc Aggro", value = "MurlocAggroLocal" },
|
||||
{ label = "Auction Open", value = "AuctionWindowOpen"},
|
||||
{ label = "Level Up", value = "LEVELUP" },
|
||||
})
|
||||
ActionButton("Test Warning Sound", function()
|
||||
local snd = RelationshipsThreatPlatesDB.warningSoundName or "RaidWarning"
|
||||
pcall(PlaySound, snd)
|
||||
end)
|
||||
|
||||
-- ==============================================================
|
||||
-- WINDOW SECTION (2.6)
|
||||
-- ==============================================================
|
||||
SectionLabel("Config Window")
|
||||
ActionButton("Reset Config Window Position", function()
|
||||
RelationshipsThreatPlatesDB.guiPos = { point = "CENTER", relPoint = "CENTER", x = 0, y = 0 }
|
||||
if RelationshipsThreatPlatesGUI then
|
||||
RelationshipsThreatPlatesGUI:ClearAllPoints()
|
||||
RelationshipsThreatPlatesGUI:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
||||
end
|
||||
end)
|
||||
|
||||
-- ==============================================================
|
||||
-- Reset button at bottom
|
||||
-- ==============================================================
|
||||
|
||||
Reference in New Issue
Block a user