Add network messenger config

This commit is contained in:
2025-01-15 13:19:10 +01:00
parent 688f2f4b30
commit f4421f0334
2 changed files with 20 additions and 44 deletions

View File

@@ -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

2
_L.lua
View File

@@ -85,6 +85,7 @@ shared.L = {
addonPrefix = "Addon Prefix",
members = "Members",
updateInterval = "Update Interval",
networkMessenger = "Network Messenger",
},
},
ru = {
@@ -169,6 +170,7 @@ shared.L = {
addonPrefix = "Префикс Аддона",
members = "Участники",
updateInterval = "Интервал Обновления",
networkMessenger = "Сетевой Мессенджер",
},
zones = {
["Orgrimmar"] = "Оргриммар",