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 -- NetworkMessenger
do do
local r, g, b, a = GetNextColor() local r, g, b, a = GetNextColor()
local networkConfigFrame = GridFrame.new("HeimdallNetworkConfig", local networkMessengerConfigFrame = GridFrame.new("HeimdallNetworkMessengerConfig",
UIParent, 12, 20) UIParent, 12, 20)
networkConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) networkMessengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(networkConfigFrame, 11, 3) configFrame:Add(networkMessengerConfigFrame, 3, 3)
local title = CreateFancyText("HeimdallNetworkConfigTitle", networkConfigFrame.frame, local title = CreateFancyText("HeimdallNetworkMessengerConfigTitle", networkMessengerConfigFrame.frame,
shared.L[Heimdall_Data.config.locale].config.network, shared.L[Heimdall_Data.config.locale].config.networkMessenger,
{ r, g, b, a }) { r, g, b, a })
networkConfigFrame:Add(title, 1, 8) networkMessengerConfigFrame:Add(title, 1, 8)
local debugButton = CreateBasicButton("HeimdallNetworkConfigDebugButton", local debugButton = CreateBasicButton("HeimdallNetworkMessengerConfigDebugButton",
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() networkMessengerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function()
Heimdall_Data.config.network.debug = not Heimdall_Data.config.network.debug Heimdall_Data.config.networkMessenger.debug = not Heimdall_Data.config.networkMessenger.debug
return Heimdall_Data.config.network.debug return Heimdall_Data.config.networkMessenger.debug
end) end)
debugButton:UpdateColor(Heimdall_Data.config.network.debug) debugButton:UpdateColor(Heimdall_Data.config.networkMessenger.debug)
networkConfigFrame:Add(debugButton, 1, 4) networkMessengerConfigFrame:Add(debugButton, 1, 4)
local enableButton = CreateBasicButton("HeimdallNetworkConfigEnableButton", local enableButton = CreateBasicButton("HeimdallNetworkMessengerConfigEnableButton",
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() networkMessengerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function()
Heimdall_Data.config.network.enabled = not Heimdall_Data.config.network.enabled Heimdall_Data.config.networkMessenger.enabled = not Heimdall_Data.config.networkMessenger.enabled
return Heimdall_Data.config.network.enabled return Heimdall_Data.config.networkMessenger.enabled
end) end)
enableButton:UpdateColor(Heimdall_Data.config.network.enabled) enableButton:UpdateColor(Heimdall_Data.config.networkMessenger.enabled)
networkConfigFrame:Add(enableButton, 1, 12) networkMessengerConfigFrame: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)
end end
-- Addon prefix -- Addon prefix

2
_L.lua
View File

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