Add network messenger config
This commit is contained in:
@@ -1956,57 +1956,31 @@ function shared.Config.Init()
|
||||
-- NetworkMessenger
|
||||
do
|
||||
local r, g, b, a = GetNextColor()
|
||||
local networkConfigFrame = GridFrame.new("HeimdallNetworkConfig",
|
||||
local networkMessengerConfigFrame = GridFrame.new("HeimdallNetworkMessengerConfig",
|
||||
UIParent, 12, 20)
|
||||
networkConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(networkConfigFrame, 11, 3)
|
||||
networkMessengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(networkMessengerConfigFrame, 3, 3)
|
||||
|
||||
local title = CreateFancyText("HeimdallNetworkConfigTitle", networkConfigFrame.frame,
|
||||
shared.L[Heimdall_Data.config.locale].config.network,
|
||||
local title = CreateFancyText("HeimdallNetworkMessengerConfigTitle", networkMessengerConfigFrame.frame,
|
||||
shared.L[Heimdall_Data.config.locale].config.networkMessenger,
|
||||
{ r, g, b, a })
|
||||
networkConfigFrame:Add(title, 1, 8)
|
||||
networkMessengerConfigFrame:Add(title, 1, 8)
|
||||
|
||||
local debugButton = CreateBasicButton("HeimdallNetworkConfigDebugButton",
|
||||
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function()
|
||||
Heimdall_Data.config.network.debug = not Heimdall_Data.config.network.debug
|
||||
return Heimdall_Data.config.network.debug
|
||||
local debugButton = CreateBasicButton("HeimdallNetworkMessengerConfigDebugButton",
|
||||
networkMessengerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function()
|
||||
Heimdall_Data.config.networkMessenger.debug = not Heimdall_Data.config.networkMessenger.debug
|
||||
return Heimdall_Data.config.networkMessenger.debug
|
||||
end)
|
||||
debugButton:UpdateColor(Heimdall_Data.config.network.debug)
|
||||
networkConfigFrame:Add(debugButton, 1, 4)
|
||||
debugButton:UpdateColor(Heimdall_Data.config.networkMessenger.debug)
|
||||
networkMessengerConfigFrame:Add(debugButton, 1, 4)
|
||||
|
||||
local enableButton = CreateBasicButton("HeimdallNetworkConfigEnableButton",
|
||||
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function()
|
||||
Heimdall_Data.config.network.enabled = not Heimdall_Data.config.network.enabled
|
||||
return Heimdall_Data.config.network.enabled
|
||||
local enableButton = CreateBasicButton("HeimdallNetworkMessengerConfigEnableButton",
|
||||
networkMessengerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function()
|
||||
Heimdall_Data.config.networkMessenger.enabled = not Heimdall_Data.config.networkMessenger.enabled
|
||||
return Heimdall_Data.config.networkMessenger.enabled
|
||||
end)
|
||||
enableButton:UpdateColor(Heimdall_Data.config.network.enabled)
|
||||
networkConfigFrame:Add(enableButton, 1, 12)
|
||||
|
||||
local members = CreateBasicBigEditBox("HeimdallNetworkConfigMembers",
|
||||
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.members,
|
||||
table.concat(Heimdall_Data.config.network.members, ","),
|
||||
function(self)
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.network.members = StringToArray(text, ",")
|
||||
print("Members set to", table.concat(Heimdall_Data.config.network.members, ","))
|
||||
self:SetText(table.concat(Heimdall_Data.config.network.members, ","))
|
||||
end)
|
||||
networkConfigFrame:Add(members, 5, 6)
|
||||
|
||||
local updateInterval = CreateBasicSmallEditBox("HeimdallNetworkConfigUpdateInterval",
|
||||
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.updateInterval,
|
||||
tostring(Heimdall_Data.config.network.updateInterval),
|
||||
function(self)
|
||||
local text = self:GetText()
|
||||
if string.match(text, "%d+") then
|
||||
Heimdall_Data.config.network.updateInterval = tonumber(text)
|
||||
print("Update interval set to", tostring(text))
|
||||
else
|
||||
print("Invalid update interval", text)
|
||||
self:SetText(tostring(Heimdall_Data.config.network.updateInterval))
|
||||
end
|
||||
end)
|
||||
networkConfigFrame:Add(updateInterval, 2, 6)
|
||||
enableButton:UpdateColor(Heimdall_Data.config.networkMessenger.enabled)
|
||||
networkMessengerConfigFrame:Add(enableButton, 1, 12)
|
||||
end
|
||||
|
||||
-- Addon prefix
|
||||
|
||||
Reference in New Issue
Block a user