Add more config options

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

View File

@@ -54,9 +54,9 @@ function shared.Config.Init()
})
spotterConfigFrame:SetBackdropColor(0, 0, 0, 0.8)
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:SetText("Enable Spotter")
spotterEnableButton.text:SetPoint("LEFT", spotterEnableButton, "RIGHT", 0, 0)
@@ -66,7 +66,74 @@ function shared.Config.Init()
spotterEnableButton:SetScript("OnClick", function()
Heimdall_Data.config.spotter.enabled = spotterEnableButton:GetChecked()
end)
--
local spotterEveryoneButton = CreateFrame("CheckButton", "HeimdallSpotterEveryone", spotterConfigFrame,
"UICheckButtonTemplate")
spotterEveryoneButton.text = spotterEveryoneButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
spotterEveryoneButton.text:SetText("Everyone")
spotterEveryoneButton.text:SetPoint("LEFT", spotterEveryoneButton, "RIGHT", 0, 0)
spotterEveryoneButton:SetSize(24, 24)
spotterEveryoneButton:SetPoint("LEFT", spotterEnableButton, "LEFT", 128, 0)
spotterEveryoneButton:SetChecked(Heimdall_Data.config.spotter.everyone)
spotterEveryoneButton:SetScript("OnClick", function()
Heimdall_Data.config.spotter.everyone = spotterEveryoneButton:GetChecked()
end)
local spotterHostileButton = CreateFrame("CheckButton", "HeimdallSpotterHostile", spotterConfigFrame,
"UICheckButtonTemplate")
spotterHostileButton.text = spotterHostileButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
spotterHostileButton.text:SetText("Hostile")
spotterHostileButton.text:SetPoint("LEFT", spotterHostileButton, "RIGHT", 0, 0)
spotterHostileButton:SetSize(24, 24)
spotterHostileButton:SetPoint("LEFT", spotterEnableButton, "LEFT", 0, -24)
spotterHostileButton:SetChecked(Heimdall_Data.config.spotter.hostile)
spotterHostileButton:SetScript("OnClick", function()
Heimdall_Data.config.spotter.hostile = spotterHostileButton:GetChecked()
end)
local spotterAllianceButton = CreateFrame("CheckButton", "HeimdallSpotterAlliance", spotterConfigFrame,
"UICheckButtonTemplate")
spotterAllianceButton.text = spotterAllianceButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
spotterAllianceButton.text:SetText("Alliance")
spotterAllianceButton.text:SetPoint("LEFT", spotterAllianceButton, "RIGHT", 0, 0)
spotterAllianceButton:SetSize(24, 24)
spotterAllianceButton:SetPoint("LEFT", spotterEveryoneButton, "LEFT", 0, -24)
spotterAllianceButton:SetChecked(Heimdall_Data.config.spotter.alliance)
spotterAllianceButton:SetScript("OnClick", function()
Heimdall_Data.config.spotter.alliance = spotterAllianceButton:GetChecked()
end)
local spotterStinkyButton = CreateFrame("CheckButton", "HeimdallSpotterStinky", spotterConfigFrame,
"UICheckButtonTemplate")
spotterStinkyButton.text = spotterStinkyButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
spotterStinkyButton.text:SetText("Stinky")
spotterStinkyButton.text:SetPoint("LEFT", spotterStinkyButton, "RIGHT", 0, 0)
spotterStinkyButton:SetSize(24, 24)
spotterStinkyButton:SetPoint("LEFT", spotterHostileButton, "LEFT", 0, -24)
spotterStinkyButton:SetChecked(Heimdall_Data.config.spotter.stinky)
spotterStinkyButton:SetScript("OnClick", function()
Heimdall_Data.config.spotter.stinky = spotterStinkyButton:GetChecked()
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")
@@ -76,19 +143,6 @@ function shared.Config.Init()
-- print("Button was clicked!")
-- end)
--
-- local checkButton = CreateFrame("CheckButton", nil, configFrame, "UICheckButtonTemplate")
-- checkButton:SetPoint("TOPRIGHT", configFrame, "TOPRIGHT", -10, -40)
-- checkButton.text = checkButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
-- checkButton.text:SetText("Check Me")
-- checkButton.text:SetPoint("LEFT", checkButton, "RIGHT", 5, 0)
-- checkButton:SetScript("OnClick", function()
-- if checkButton:GetChecked() then
-- print("Check Button is checked.")
-- else
-- print("Check Button is unchecked.")
-- end
-- end)
--
-- -- Create a text element
-- local text = configFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
-- text:SetText("This is some text in the frame.")