Add other text fields for spotter config
This commit is contained in:
@@ -336,8 +336,8 @@ function shared.Config.Init()
|
||||
---@param name string
|
||||
---@param parent Frame
|
||||
---@param text string
|
||||
---@param onDone fun(text: string)
|
||||
local function CreateBasicSmallEditBox(name, parent, text, onDone)
|
||||
---@param onDone fun(editBox: Frame)
|
||||
local function CreateBasicSmallEditBox(name, parent, text, initialValue, onDone)
|
||||
local container = GridFrame.new(name, parent, 1, 1)
|
||||
local editBox = CreateFrame("EditBox", name .. "EditBox", container.frame)
|
||||
local editBoxtext = editBox:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
@@ -351,7 +351,7 @@ function shared.Config.Init()
|
||||
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
|
||||
tile = true,
|
||||
tileSize = 2,
|
||||
edgeSize = 2,
|
||||
edgeSize = 12,
|
||||
insets = {
|
||||
left = 2,
|
||||
right = 2,
|
||||
@@ -361,15 +361,10 @@ function shared.Config.Init()
|
||||
})
|
||||
editBox:SetBackdropColor(0.8, 0.8, 0.8, 1)
|
||||
editBox:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
|
||||
editBox:SetScript("OnEnterPressed", function()
|
||||
onDone(editBox:GetText())
|
||||
end)
|
||||
editBox:SetScript("OnEscapePressed", function()
|
||||
editBox:ClearFocus()
|
||||
end)
|
||||
editBox:SetScript("OnEditFocusLost", function()
|
||||
onDone(editBox:GetText())
|
||||
end)
|
||||
editBox:SetScript("OnEnterPressed", function() editBox:ClearFocus() end)
|
||||
editBox:SetScript("OnEscapePressed", function() editBox:ClearFocus() end)
|
||||
editBox:SetScript("OnEditFocusLost", function() onDone(editBox) end)
|
||||
editBox:SetText(initialValue)
|
||||
container:Add(editBoxtext, 1, 1)
|
||||
container:Add(editBox, 2, 1)
|
||||
-- I don't understand why this hack is necessary
|
||||
@@ -388,7 +383,7 @@ function shared.Config.Init()
|
||||
do
|
||||
local spotterConfigFrame = GridFrame.new("HeimdallSpotterConfig",
|
||||
UIParent, 12, 20)
|
||||
configFrame:Add(spotterConfigFrame, 6, 3)
|
||||
configFrame:Add(spotterConfigFrame, 5, 3)
|
||||
|
||||
local title = spotterConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
title:SetText("Spotter")
|
||||
@@ -434,15 +429,49 @@ function shared.Config.Init()
|
||||
stinkyButton:UpdateColor(Heimdall_Data.config.spotter.stinky)
|
||||
spotterConfigFrame:Add(stinkyButton, 1, 4)
|
||||
|
||||
local notifyChannel = CreateBasicSmallEditBox("HeimdallSpotterConfigTestEditBox",
|
||||
spotterConfigFrame.frame, "Notify Channel", function(text)
|
||||
local notifyChannel = CreateBasicSmallEditBox("HeimdallSpotterConfigNotifyChannel",
|
||||
spotterConfigFrame.frame, "Notify Channel",
|
||||
Heimdall_Data.config.spotter.notifyChannel,
|
||||
function(self)
|
||||
local text = self:GetText()
|
||||
if string.match(text, "%S+") then
|
||||
Heimdall_Data.config.spotter.notifyChannel = text
|
||||
print("Notify channel set to", tostring(text))
|
||||
else
|
||||
print("Invalid channel name", tostring(text))
|
||||
self:SetText(Heimdall_Data.config.spotter.notifyChannel)
|
||||
end
|
||||
end)
|
||||
spotterConfigFrame:Add(notifyChannel, 2, 4)
|
||||
|
||||
local zoneOverride = CreateBasicSmallEditBox("HeimdallSpotterConfigZoneOverride",
|
||||
spotterConfigFrame.frame, "Zone Override",
|
||||
Heimdall_Data.config.spotter.zoneOverride,
|
||||
function(self)
|
||||
local text = self:GetText()
|
||||
if string.match(text, "%S+") then
|
||||
Heimdall_Data.config.spotter.zoneOverride = text
|
||||
print("Zone override set to", tostring(text))
|
||||
else
|
||||
print("Invalid zone override", tostring(text))
|
||||
self:SetText(Heimdall_Data.config.spotter.zoneOverride)
|
||||
end
|
||||
end)
|
||||
spotterConfigFrame:Add(zoneOverride, 2, 4)
|
||||
|
||||
local throttleTime = CreateBasicSmallEditBox("HeimdallSpotterConfigThrottleTime",
|
||||
spotterConfigFrame.frame, "Throttle Time",
|
||||
Heimdall_Data.config.spotter.throttleTime,
|
||||
function(self)
|
||||
local text = self:GetText()
|
||||
if string.match(text, "%d+") then
|
||||
Heimdall_Data.config.spotter.throttleTime = tonumber(text)
|
||||
else
|
||||
print("Invalid throttle time", tostring(text))
|
||||
self:SetText(Heimdall_Data.config.spotter.throttleTime)
|
||||
end
|
||||
end)
|
||||
spotterConfigFrame:Add(throttleTime, 2, 4)
|
||||
end
|
||||
|
||||
--local spotterEveryoneButton = BasicButton("HeimdallSpotterEveryone", spotterConfigFrame, "Everyone", function(state)
|
||||
|
Reference in New Issue
Block a user