Color the boxes so the modules are easily told apart
This commit is contained in:
@@ -312,8 +312,8 @@ local configFrame = StaticGridFrame.new("HeimdallConfig",
|
||||
40, 12,
|
||||
{ w = 1024 + 512, h = 1024 })
|
||||
configFrame:MakeMovable()
|
||||
local oldAdd = configFrame.Add
|
||||
configFrame.Add = function(self, frame, rowspan, colspan)
|
||||
local oldAdd = configFrame.Add
|
||||
configFrame.Add = function(self, frame, rowspan, colspan)
|
||||
print("Adding", frame, rowspan, colspan)
|
||||
oldAdd(self, frame, rowspan, colspan)
|
||||
end
|
||||
@@ -323,7 +323,8 @@ end
|
||||
-- end
|
||||
--end)
|
||||
|
||||
local colors = {
|
||||
local colorIndex = 1
|
||||
local colors = {
|
||||
{ 1, 0, 0, 1 },
|
||||
{ 0, 1, 0, 1 },
|
||||
{ 0, 0, 1, 1 },
|
||||
@@ -350,16 +351,34 @@ local colors = {
|
||||
--configFrame:Add(HeimdallTestFrame, 20, 12)
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Config = {}
|
||||
shared.Config = {}
|
||||
function shared.Config.Init()
|
||||
local buttonColors = {
|
||||
enabled = { 0, 1, 0, 1 },
|
||||
disabled = { 1, 0, 0, 1 }
|
||||
}
|
||||
local function CreateFancyText(name, parent, text, color)
|
||||
local r, g, b, a = unpack(color)
|
||||
local textFrame = CreateFrame("Frame", name .. "TextFrame", parent)
|
||||
local textElement = textFrame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
textElement:SetText(text)
|
||||
textElement:SetTextColor(r, g, b, a)
|
||||
textElement:SetPoint("CENTER", textFrame, "CENTER", 0, 0)
|
||||
textFrame:SetBackdrop({
|
||||
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
||||
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
|
||||
tile = true,
|
||||
tileSize = 2,
|
||||
edgeSize = 12,
|
||||
})
|
||||
textFrame:SetBackdropColor(r, g, b, 0.3)
|
||||
textFrame:SetBackdropBorderColor(r, g, b, 0.5)
|
||||
return textFrame
|
||||
end
|
||||
---@param name string
|
||||
---@param parent Frame
|
||||
---@param onClick fun(): boolean
|
||||
local function BasicButton(name, parent, text, onClick)
|
||||
local function CreateBasicButton(name, parent, text, onClick)
|
||||
local button = CreateFrame("Frame", name, parent)
|
||||
button:SetScript("OnMouseDown", function()
|
||||
local res = onClick()
|
||||
@@ -483,15 +502,17 @@ function shared.Config.Init()
|
||||
configFrame:Add(title, 1, 12)
|
||||
|
||||
do
|
||||
local r, g, b, a = unpack(colors[colorIndex])
|
||||
colorIndex = colorIndex + 1
|
||||
local spotterConfigFrame = GridFrame.new("HeimdallSpotterConfig",
|
||||
UIParent, 12, 20)
|
||||
spotterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(spotterConfigFrame, 5, 3)
|
||||
|
||||
local title = spotterConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
title:SetText("Spotter")
|
||||
local title = CreateFancyText("HeimdallSpotterConfigTitle", spotterConfigFrame.frame, "Spotter", { r, g, b, a })
|
||||
spotterConfigFrame:Add(title, 1, 12)
|
||||
|
||||
local enableButton = BasicButton("HeimdallSpotterConfigEnableButton",
|
||||
local enableButton = CreateBasicButton("HeimdallSpotterConfigEnableButton",
|
||||
spotterConfigFrame.frame, "Enabled", function()
|
||||
Heimdall_Data.config.spotter.enabled = not Heimdall_Data.config.spotter.enabled
|
||||
return Heimdall_Data.config.spotter.enabled
|
||||
@@ -499,7 +520,7 @@ function shared.Config.Init()
|
||||
enableButton:UpdateColor(Heimdall_Data.config.spotter.enabled)
|
||||
spotterConfigFrame:Add(enableButton, 1, 6)
|
||||
|
||||
local everyoneButton = BasicButton("HeimdallSpotterConfigEveryoneButton",
|
||||
local everyoneButton = CreateBasicButton("HeimdallSpotterConfigEveryoneButton",
|
||||
spotterConfigFrame.frame, "Everyone", function()
|
||||
Heimdall_Data.config.spotter.everyone = not Heimdall_Data.config.spotter.everyone
|
||||
return Heimdall_Data.config.spotter.everyone
|
||||
@@ -507,7 +528,7 @@ function shared.Config.Init()
|
||||
everyoneButton:UpdateColor(Heimdall_Data.config.spotter.everyone)
|
||||
spotterConfigFrame:Add(everyoneButton, 1, 6)
|
||||
|
||||
local hostileButton = BasicButton("HeimdallSpotterConfigHostileButton",
|
||||
local hostileButton = CreateBasicButton("HeimdallSpotterConfigHostileButton",
|
||||
spotterConfigFrame.frame, "Hostile", function()
|
||||
Heimdall_Data.config.spotter.hostile = not Heimdall_Data.config.spotter.hostile
|
||||
return Heimdall_Data.config.spotter.hostile
|
||||
@@ -515,7 +536,7 @@ function shared.Config.Init()
|
||||
hostileButton:UpdateColor(Heimdall_Data.config.spotter.hostile)
|
||||
spotterConfigFrame:Add(hostileButton, 1, 4)
|
||||
|
||||
local allianceButton = BasicButton("HeimdallSpotterConfigAllianceButton",
|
||||
local allianceButton = CreateBasicButton("HeimdallSpotterConfigAllianceButton",
|
||||
spotterConfigFrame.frame, "Alliance", function()
|
||||
Heimdall_Data.config.spotter.alliance = not Heimdall_Data.config.spotter.alliance
|
||||
return Heimdall_Data.config.spotter.alliance
|
||||
@@ -523,7 +544,7 @@ function shared.Config.Init()
|
||||
allianceButton:UpdateColor(Heimdall_Data.config.spotter.alliance)
|
||||
spotterConfigFrame:Add(allianceButton, 1, 4)
|
||||
|
||||
local stinkyButton = BasicButton("HeimdallSpotterConfigStinkyButton",
|
||||
local stinkyButton = CreateBasicButton("HeimdallSpotterConfigStinkyButton",
|
||||
spotterConfigFrame.frame, "Stinky", function()
|
||||
Heimdall_Data.config.spotter.stinky = not Heimdall_Data.config.spotter.stinky
|
||||
return Heimdall_Data.config.spotter.stinky
|
||||
@@ -577,15 +598,17 @@ function shared.Config.Init()
|
||||
end
|
||||
|
||||
do
|
||||
local r, g, b, a = unpack(colors[colorIndex])
|
||||
colorIndex = colorIndex + 1
|
||||
local whoerConfigFrame = GridFrame.new("HeimdallWhoerConfig",
|
||||
UIParent, 12, 20)
|
||||
whoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(whoerConfigFrame, 9, 3)
|
||||
|
||||
local title = whoerConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
title:SetText("Whoer")
|
||||
local title = CreateFancyText("HeimdallWhoerConfigTitle", whoerConfigFrame.frame, "Whoer", { r, g, b, a })
|
||||
whoerConfigFrame:Add(title, 1, 12)
|
||||
|
||||
local enableButton = BasicButton("HeimdallWhoerConfigEnableButton",
|
||||
local enableButton = CreateBasicButton("HeimdallWhoerConfigEnableButton",
|
||||
whoerConfigFrame.frame, "Enabled", function()
|
||||
Heimdall_Data.config.who.enabled = not Heimdall_Data.config.who.enabled
|
||||
return Heimdall_Data.config.who.enabled
|
||||
@@ -593,7 +616,7 @@ function shared.Config.Init()
|
||||
enableButton:UpdateColor(Heimdall_Data.config.who.enabled)
|
||||
whoerConfigFrame:Add(enableButton, 1, 6)
|
||||
|
||||
local doWhisperButton = BasicButton("HeimdallWhoerConfigDoWhisperButton",
|
||||
local doWhisperButton = CreateBasicButton("HeimdallWhoerConfigDoWhisperButton",
|
||||
whoerConfigFrame.frame, "Do Whisper", function()
|
||||
Heimdall_Data.config.who.doWhisper = not Heimdall_Data.config.who.doWhisper
|
||||
return Heimdall_Data.config.who.doWhisper
|
||||
@@ -651,15 +674,18 @@ function shared.Config.Init()
|
||||
end
|
||||
|
||||
do
|
||||
local r, g, b, a = unpack(colors[colorIndex])
|
||||
colorIndex = colorIndex + 1
|
||||
local messengerConfigFrame = GridFrame.new("HeimdallMessengerConfig",
|
||||
UIParent, 12, 20)
|
||||
messengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(messengerConfigFrame, 3, 3)
|
||||
|
||||
local title = messengerConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
title:SetText("Messenger")
|
||||
local title = CreateFancyText("HeimdallMessengerConfigTitle", messengerConfigFrame.frame, "Messenger",
|
||||
{ r, g, b, a })
|
||||
messengerConfigFrame:Add(title, 1, 12)
|
||||
|
||||
local enableButton = BasicButton("HeimdallMessengerConfigEnableButton",
|
||||
local enableButton = CreateBasicButton("HeimdallMessengerConfigEnableButton",
|
||||
messengerConfigFrame.frame, "Enabled", function()
|
||||
Heimdall_Data.config.messenger.enabled = not Heimdall_Data.config.messenger.enabled
|
||||
return Heimdall_Data.config.messenger.enabled
|
||||
@@ -684,15 +710,18 @@ function shared.Config.Init()
|
||||
end
|
||||
|
||||
do
|
||||
local r, g, b, a = unpack(colors[colorIndex])
|
||||
colorIndex = colorIndex + 1
|
||||
local deathReporterConfigFrame = GridFrame.new("HeimdallDeathReporterConfig",
|
||||
UIParent, 12, 20)
|
||||
deathReporterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(deathReporterConfigFrame, 6, 3)
|
||||
|
||||
local title = deathReporterConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
title:SetText("Death Reporter")
|
||||
local title = CreateFancyText("HeimdallDeathReporterConfigTitle", deathReporterConfigFrame.frame, "Death Reporter",
|
||||
{ r, g, b, a })
|
||||
deathReporterConfigFrame:Add(title, 1, 12)
|
||||
|
||||
local enableButton = BasicButton("HeimdallDeathReporterConfigEnableButton",
|
||||
local enableButton = CreateBasicButton("HeimdallDeathReporterConfigEnableButton",
|
||||
deathReporterConfigFrame.frame, "Enabled", function()
|
||||
Heimdall_Data.config.deathReporter.enabled = not Heimdall_Data.config.deathReporter.enabled
|
||||
return Heimdall_Data.config.deathReporter.enabled
|
||||
@@ -700,7 +729,7 @@ function shared.Config.Init()
|
||||
enableButton:UpdateColor(Heimdall_Data.config.deathReporter.enabled)
|
||||
deathReporterConfigFrame:Add(enableButton, 1, 6)
|
||||
|
||||
local doWhisperButton = BasicButton("HeimdallDeathReporterConfigDoWhisperButton",
|
||||
local doWhisperButton = CreateBasicButton("HeimdallDeathReporterConfigDoWhisperButton",
|
||||
deathReporterConfigFrame.frame, "Do Whisper", function()
|
||||
Heimdall_Data.config.deathReporter.doWhisper = not Heimdall_Data.config.deathReporter.doWhisper
|
||||
return Heimdall_Data.config.deathReporter.doWhisper
|
||||
@@ -770,15 +799,17 @@ function shared.Config.Init()
|
||||
end
|
||||
|
||||
do
|
||||
local r, g, b, a = unpack(colors[colorIndex])
|
||||
colorIndex = colorIndex + 1
|
||||
local inviterConfigFrame = GridFrame.new("HeimdallInviterConfig",
|
||||
UIParent, 12, 20)
|
||||
inviterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(inviterConfigFrame, 6, 3)
|
||||
|
||||
local title = inviterConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
title:SetText("Inviter")
|
||||
local title = CreateFancyText("HeimdallInviterConfigTitle", inviterConfigFrame.frame, "Inviter", { r, g, b, a })
|
||||
inviterConfigFrame:Add(title, 1, 12)
|
||||
|
||||
local enableButton = BasicButton("HeimdallInviterConfigEnableButton",
|
||||
local enableButton = CreateBasicButton("HeimdallInviterConfigEnableButton",
|
||||
inviterConfigFrame.frame, "Enabled", function()
|
||||
Heimdall_Data.config.inviter.enabled = not Heimdall_Data.config.inviter.enabled
|
||||
return Heimdall_Data.config.inviter.enabled
|
||||
@@ -786,7 +817,7 @@ function shared.Config.Init()
|
||||
enableButton:UpdateColor(Heimdall_Data.config.inviter.enabled)
|
||||
inviterConfigFrame:Add(enableButton, 1, 4)
|
||||
|
||||
local allAssistButton = BasicButton("HeimdallInviterConfigAllAssistButton",
|
||||
local allAssistButton = CreateBasicButton("HeimdallInviterConfigAllAssistButton",
|
||||
inviterConfigFrame.frame, "All Assist", function()
|
||||
Heimdall_Data.config.inviter.allAssist = not Heimdall_Data.config.inviter.allAssist
|
||||
return Heimdall_Data.config.inviter.allAssist
|
||||
@@ -794,7 +825,7 @@ function shared.Config.Init()
|
||||
allAssistButton:UpdateColor(Heimdall_Data.config.inviter.allAssist)
|
||||
inviterConfigFrame:Add(allAssistButton, 1, 4)
|
||||
|
||||
local agentsAssist = BasicButton("HeimdallInviterConfigAgentsAssistButton",
|
||||
local agentsAssist = CreateBasicButton("HeimdallInviterConfigAgentsAssistButton",
|
||||
inviterConfigFrame.frame, "Agents Assist", function()
|
||||
Heimdall_Data.config.inviter.agentsAssist = not Heimdall_Data.config.inviter.agentsAssist
|
||||
return Heimdall_Data.config.inviter.agentsAssist
|
||||
@@ -874,7 +905,7 @@ function shared.Config.Init()
|
||||
end)
|
||||
inviterConfigFrame:Add(afkThreshold, 2, 6)
|
||||
|
||||
local kickOffline = BasicButton("HeimdallInviterConfigKickOfflineButton",
|
||||
local kickOffline = CreateBasicButton("HeimdallInviterConfigKickOfflineButton",
|
||||
inviterConfigFrame.frame, "Kick Offline", function()
|
||||
Heimdall_Data.config.inviter.kickOffline = not Heimdall_Data.config.inviter.kickOffline
|
||||
return Heimdall_Data.config.inviter.kickOffline
|
||||
|
Reference in New Issue
Block a user