Add more config options

This commit is contained in:
2025-01-03 09:16:54 +01:00
parent bff1a4acf9
commit 58a7ecd723

View File

@@ -7,7 +7,7 @@ local configFrame = CreateFrame("Frame", "HeimdallConfig", UIParent)
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
shared.Config = {} shared.Config = {}
function shared.Config.Init() function shared.Config.Init()
configFrame:SetSize(256+256, 512) configFrame:SetSize(256 + 256, 512)
configFrame:SetPoint("CENTER") configFrame:SetPoint("CENTER")
configFrame:SetFrameStrata("HIGH") configFrame:SetFrameStrata("HIGH")
configFrame:EnableMouse(true) configFrame:EnableMouse(true)
@@ -54,9 +54,9 @@ function shared.Config.Init()
}) })
spotterConfigFrame:SetBackdropColor(0, 0, 0, 0.8) spotterConfigFrame:SetBackdropColor(0, 0, 0, 0.8)
spotterConfigFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1) spotterConfigFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
-- spotterConfigFrame:Hide()
local spotterEnableButton = CreateFrame("CheckButton", "HeimdallSpotterEnable", spotterConfigFrame, "UICheckButtonTemplate") local spotterEnableButton = CreateFrame("CheckButton", "HeimdallSpotterEnable", spotterConfigFrame,
"UICheckButtonTemplate")
spotterEnableButton.text = spotterEnableButton:CreateFontString(nil, "OVERLAY", "GameFontNormal") spotterEnableButton.text = spotterEnableButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
spotterEnableButton.text:SetText("Enable Spotter") spotterEnableButton.text:SetText("Enable Spotter")
spotterEnableButton.text:SetPoint("LEFT", spotterEnableButton, "RIGHT", 0, 0) spotterEnableButton.text:SetPoint("LEFT", spotterEnableButton, "RIGHT", 0, 0)
@@ -66,56 +66,110 @@ function shared.Config.Init()
spotterEnableButton:SetScript("OnClick", function() spotterEnableButton:SetScript("OnClick", function()
Heimdall_Data.config.spotter.enabled = spotterEnableButton:GetChecked() Heimdall_Data.config.spotter.enabled = spotterEnableButton:GetChecked()
end) end)
--
-- ---@type table local spotterEveryoneButton = CreateFrame("CheckButton", "HeimdallSpotterEveryone", spotterConfigFrame,
-- local spotterEnableButton = CreateFrame("Button", "HeimdallSpotterEnable", configFrame, "UIPanelButtonTemplate") "UICheckButtonTemplate")
-- spotterEnableButton:SetText("Enable Spotter") spotterEveryoneButton.text = spotterEveryoneButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
-- spotterEnableButton:SetSize(100, 30) spotterEveryoneButton.text:SetText("Everyone")
-- spotterEnableButton:SetPoint("TOPLEFT", configFrame, "TOPLEFT", 10, -40) spotterEveryoneButton.text:SetPoint("LEFT", spotterEveryoneButton, "RIGHT", 0, 0)
-- spotterEnableButton:SetScript("OnClick", function() spotterEveryoneButton:SetSize(24, 24)
-- print("Button was clicked!") spotterEveryoneButton:SetPoint("LEFT", spotterEnableButton, "LEFT", 128, 0)
-- end) spotterEveryoneButton:SetChecked(Heimdall_Data.config.spotter.everyone)
-- spotterEveryoneButton:SetScript("OnClick", function()
-- local checkButton = CreateFrame("CheckButton", nil, configFrame, "UICheckButtonTemplate") Heimdall_Data.config.spotter.everyone = spotterEveryoneButton:GetChecked()
-- checkButton:SetPoint("TOPRIGHT", configFrame, "TOPRIGHT", -10, -40) end)
-- checkButton.text = checkButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
-- checkButton.text:SetText("Check Me") local spotterHostileButton = CreateFrame("CheckButton", "HeimdallSpotterHostile", spotterConfigFrame,
-- checkButton.text:SetPoint("LEFT", checkButton, "RIGHT", 5, 0) "UICheckButtonTemplate")
-- checkButton:SetScript("OnClick", function() spotterHostileButton.text = spotterHostileButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
-- if checkButton:GetChecked() then spotterHostileButton.text:SetText("Hostile")
-- print("Check Button is checked.") spotterHostileButton.text:SetPoint("LEFT", spotterHostileButton, "RIGHT", 0, 0)
-- else spotterHostileButton:SetSize(24, 24)
-- print("Check Button is unchecked.") spotterHostileButton:SetPoint("LEFT", spotterEnableButton, "LEFT", 0, -24)
-- end spotterHostileButton:SetChecked(Heimdall_Data.config.spotter.hostile)
-- end) spotterHostileButton:SetScript("OnClick", function()
-- Heimdall_Data.config.spotter.hostile = spotterHostileButton:GetChecked()
-- -- Create a text element end)
-- local text = configFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
-- text:SetText("This is some text in the frame.") local spotterAllianceButton = CreateFrame("CheckButton", "HeimdallSpotterAlliance", spotterConfigFrame,
-- text:SetPoint("TOPLEFT", configFrame, "TOPLEFT", 10, -80) "UICheckButtonTemplate")
-- spotterAllianceButton.text = spotterAllianceButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
-- -- Create a small edit box spotterAllianceButton.text:SetText("Alliance")
-- local smallEditBox = CreateFrame("EditBox", nil, configFrame) spotterAllianceButton.text:SetPoint("LEFT", spotterAllianceButton, "RIGHT", 0, 0)
-- smallEditBox:SetSize(200, 20) spotterAllianceButton:SetSize(24, 24)
-- smallEditBox:SetPoint("TOPLEFT", configFrame, "TOPLEFT", 10, -110) spotterAllianceButton:SetPoint("LEFT", spotterEveryoneButton, "LEFT", 0, -24)
-- smallEditBox:SetAutoFocus(false) spotterAllianceButton:SetChecked(Heimdall_Data.config.spotter.alliance)
-- smallEditBox:SetFontObject("GameFontNormal") spotterAllianceButton:SetScript("OnClick", function()
-- smallEditBox:SetScript("OnEnterPressed", function() Heimdall_Data.config.spotter.alliance = spotterAllianceButton:GetChecked()
-- print("Entered text: " .. smallEditBox:GetText()) end)
-- end)
-- local spotterStinkyButton = CreateFrame("CheckButton", "HeimdallSpotterStinky", spotterConfigFrame,
-- -- Create a large edit box "UICheckButtonTemplate")
-- local largeEditBox = CreateFrame("EditBox", nil, configFrame) spotterStinkyButton.text = spotterStinkyButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
-- largeEditBox:SetSize(280, 100) spotterStinkyButton.text:SetText("Stinky")
-- largeEditBox:SetPoint("TOP", configFrame, "TOP", 0, -150) spotterStinkyButton.text:SetPoint("LEFT", spotterStinkyButton, "RIGHT", 0, 0)
-- largeEditBox:SetAutoFocus(false) spotterStinkyButton:SetSize(24, 24)
-- largeEditBox:SetFontObject("GameFontNormal") spotterStinkyButton:SetPoint("LEFT", spotterHostileButton, "LEFT", 0, -24)
-- largeEditBox:SetMultiLine(true) spotterStinkyButton:SetChecked(Heimdall_Data.config.spotter.stinky)
-- largeEditBox:EnableMouse(true) spotterStinkyButton:SetScript("OnClick", function()
-- largeEditBox:SetMaxLetters(0) Heimdall_Data.config.spotter.stinky = spotterStinkyButton:GetChecked()
-- largeEditBox:SetScript("OnEscapePressed", function() end)
-- largeEditBox:ClearFocus()
-- end) local spotterThrottleBox = CreateFrame("EditBox", "HeimdallSpotterThrottle", configFrame)
spotterThrottleBox.text = spotterThrottleBox:CreateFontString(nil, "OVERLAY", "GameFontNormal")
spotterThrottleBox.text:SetText("Throttle Time")
spotterThrottleBox.text:SetPoint("TOPLEFT", spotterThrottleBox, "TOPLEFT", 0, 8)
spotterThrottleBox:SetNumeric(true)
spotterThrottleBox:SetSize(128, 24)
spotterThrottleBox:SetPoint("LEFT", spotterAllianceButton, "LEFT", 0, -24-8)
spotterThrottleBox:SetAutoFocus(false)
spotterThrottleBox:SetFontObject("GameFontNormal")
spotterThrottleBox:SetText(Heimdall_Data.config.spotter.throttleTime)
spotterThrottleBox:SetScript("OnEnterPressed", function()
local throttleTime = tonumber(spotterThrottleBox:GetText())
if throttleTime then
Heimdall_Data.config.spotter.throttleTime = throttleTime
end
end)
spotterThrottleBox:SetScript("OnEscapePressed", function()
spotterThrottleBox:ClearFocus()
end)
-- ---@type table
-- local spotterEnableButton = CreateFrame("Button", "HeimdallSpotterEnable", configFrame, "UIPanelButtonTemplate")
-- spotterEnableButton:SetText("Enable Spotter")
-- spotterEnableButton:SetSize(100, 30)
-- spotterEnableButton:SetPoint("TOPLEFT", configFrame, "TOPLEFT", 10, -40)
-- spotterEnableButton:SetScript("OnClick", function()
-- print("Button was clicked!")
-- end)
--
-- -- Create a text element
-- local text = configFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
-- text:SetText("This is some text in the frame.")
-- text:SetPoint("TOPLEFT", configFrame, "TOPLEFT", 10, -80)
--
-- -- Create a small edit box
-- local smallEditBox = CreateFrame("EditBox", nil, configFrame)
-- smallEditBox:SetSize(200, 20)
-- smallEditBox:SetPoint("TOPLEFT", configFrame, "TOPLEFT", 10, -110)
-- smallEditBox:SetAutoFocus(false)
-- smallEditBox:SetFontObject("GameFontNormal")
-- smallEditBox:SetScript("OnEnterPressed", function()
-- print("Entered text: " .. smallEditBox:GetText())
-- end)
--
-- -- Create a large edit box
-- local largeEditBox = CreateFrame("EditBox", nil, configFrame)
-- largeEditBox:SetSize(280, 100)
-- largeEditBox:SetPoint("TOP", configFrame, "TOP", 0, -150)
-- largeEditBox:SetAutoFocus(false)
-- largeEditBox:SetFontObject("GameFontNormal")
-- largeEditBox:SetMultiLine(true)
-- largeEditBox:EnableMouse(true)
-- largeEditBox:SetMaxLetters(0)
-- largeEditBox:SetScript("OnEscapePressed", function()
-- largeEditBox:ClearFocus()
-- end)
configFrame:Show() configFrame:Show()
print("Heimdall - Config loaded") print("Heimdall - Config loaded")