Implement basic structure for network

This commit is contained in:
2025-01-15 12:44:14 +01:00
parent 319e6cdd77
commit 241615238c
5 changed files with 90 additions and 1 deletions

View File

@@ -1842,7 +1842,7 @@ function shared.Config.Init()
local noterConfigFrame = GridFrame.new("HeimdallNoterConfig",
UIParent, 12, 20)
noterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(noterConfigFrame, 5, 3)
configFrame:Add(noterConfigFrame, 7, 3)
local title = CreateFancyText("HeimdallNoterConfigTitle", noterConfigFrame.frame,
shared.L[Heimdall_Data.config.locale].config.noter,
@@ -1897,6 +1897,62 @@ function shared.Config.Init()
noterConfigFrame:Add(lastNotes, 2, 6)
end
-- Network
do
local r, g, b, a = GetNextColor()
local networkConfigFrame = GridFrame.new("HeimdallNetworkConfig",
UIParent, 12, 20)
networkConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(networkConfigFrame, 11, 3)
local title = CreateFancyText("HeimdallNetworkConfigTitle", networkConfigFrame.frame,
shared.L[Heimdall_Data.config.locale].config.network,
{ r, g, b, a })
networkConfigFrame: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
end)
debugButton:UpdateColor(Heimdall_Data.config.network.debug)
networkConfigFrame: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
end)
enableButton:UpdateColor(Heimdall_Data.config.network.enabled)
networkConfigFrame:Add(enableButton, 1, 12)
local addonPrefix = CreateBasicSmallEditBox("HeimdallNetworkConfigAddonPrefix",
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.addonPrefix,
Heimdall_Data.config.network.addonPrefix,
function(self)
local text = self:GetText()
if string.match(text, "%S+") then
Heimdall_Data.config.network.addonPrefix = text
print("Addon prefix set to", tostring(text))
else
print("Invalid addon prefix", tostring(text))
self:SetText(Heimdall_Data.config.network.addonPrefix)
end
end)
networkConfigFrame:Add(addonPrefix, 2, 6)
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)
end
-- Whisper Notify
do
local r, g, b, a = GetNextColor()