完成焦点等开发
This commit is contained in:
48
Chat.lua
48
Chat.lua
@@ -1502,6 +1502,16 @@ local function EnsureProtectedTabs(db, maxId)
|
||||
tab.kind = "general"
|
||||
tab.locked = true
|
||||
if Trim(tab.name) == "" then tab.name = GENERAL or "General" end
|
||||
-- General tab: ensure all channel alias groups default to enabled
|
||||
-- except lfg/lft group which should stay off by default
|
||||
if type(tab.channelFilters) ~= "table" then tab.channelFilters = {} end
|
||||
local LFG_GROUP_CANONICAL = ChannelKey("lfg")
|
||||
for _, group in ipairs(CHANNEL_ALIAS_GROUPS) do
|
||||
local canonicalKey = ChannelKey(group[1] or "")
|
||||
if canonicalKey ~= "" and canonicalKey ~= LFG_GROUP_CANONICAL and tab.channelFilters[canonicalKey] == nil then
|
||||
tab.channelFilters[canonicalKey] = true
|
||||
end
|
||||
end
|
||||
elseif i == combatIdx then
|
||||
tab.kind = "combat"
|
||||
tab.locked = true
|
||||
@@ -1524,17 +1534,17 @@ local function EnsureDB()
|
||||
if db.showBorder == nil then db.showBorder = DEFAULTS.showBorder end
|
||||
if db.borderClassColor == nil then db.borderClassColor = DEFAULTS.borderClassColor end
|
||||
if db.showPlayerLevel == nil then db.showPlayerLevel = DEFAULTS.showPlayerLevel end
|
||||
if type(db.width) ~= "number" then db.width = DEFAULTS.width end
|
||||
if type(db.height) ~= "number" then db.height = DEFAULTS.height end
|
||||
if type(db.scale) ~= "number" then db.scale = DEFAULTS.scale end
|
||||
if type(db.fontSize) ~= "number" then db.fontSize = DEFAULTS.fontSize end
|
||||
if type(db.sidePadding) ~= "number" then db.sidePadding = DEFAULTS.sidePadding end
|
||||
if type(db.topPadding) ~= "number" then db.topPadding = DEFAULTS.topPadding end
|
||||
if type(db.bottomPadding) ~= "number" then db.bottomPadding = DEFAULTS.bottomPadding end
|
||||
if type(db.bgAlpha) ~= "number" then db.bgAlpha = DEFAULTS.bgAlpha end
|
||||
if type(db.width) ~= "number" then db.width = tonumber(db.width) or DEFAULTS.width end
|
||||
if type(db.height) ~= "number" then db.height = tonumber(db.height) or DEFAULTS.height end
|
||||
if type(db.scale) ~= "number" then db.scale = tonumber(db.scale) or DEFAULTS.scale end
|
||||
if type(db.fontSize) ~= "number" then db.fontSize = tonumber(db.fontSize) or DEFAULTS.fontSize end
|
||||
if type(db.sidePadding) ~= "number" then db.sidePadding = tonumber(db.sidePadding) or DEFAULTS.sidePadding end
|
||||
if type(db.topPadding) ~= "number" then db.topPadding = tonumber(db.topPadding) or DEFAULTS.topPadding end
|
||||
if type(db.bottomPadding) ~= "number" then db.bottomPadding = tonumber(db.bottomPadding) or DEFAULTS.bottomPadding end
|
||||
if type(db.bgAlpha) ~= "number" then db.bgAlpha = tonumber(db.bgAlpha) or DEFAULTS.bgAlpha end
|
||||
if type(db.editBoxPosition) ~= "string" then db.editBoxPosition = DEFAULTS.editBoxPosition end
|
||||
if type(db.editBoxX) ~= "number" then db.editBoxX = DEFAULTS.editBoxX end
|
||||
if type(db.editBoxY) ~= "number" then db.editBoxY = DEFAULTS.editBoxY end
|
||||
if type(db.editBoxX) ~= "number" then db.editBoxX = tonumber(db.editBoxX) or DEFAULTS.editBoxX end
|
||||
if type(db.editBoxY) ~= "number" then db.editBoxY = tonumber(db.editBoxY) or DEFAULTS.editBoxY end
|
||||
if db.translateEnabled == nil then db.translateEnabled = true end
|
||||
if db.chatMonitorEnabled == nil then db.chatMonitorEnabled = true end
|
||||
if type(db.layoutVersion) ~= "number" then db.layoutVersion = 1 end
|
||||
@@ -2076,6 +2086,9 @@ function SFrames.Chat:FindTabIndexById(tabId)
|
||||
end
|
||||
|
||||
function SFrames.Chat:ShouldAutoTranslateForTab(index, filterKey, channelName)
|
||||
if SFramesDB and SFramesDB.Chat and SFramesDB.Chat.translateEnabled == false then
|
||||
return false
|
||||
end
|
||||
local tab = self:GetTab(index)
|
||||
if not tab then return false end
|
||||
if filterKey == "channel" then
|
||||
@@ -3719,7 +3732,14 @@ function SFrames.Chat:EnsureConfigFrame()
|
||||
end)
|
||||
|
||||
local filterSection = CreateCfgSection(filtersPage, "消息与频道接收", 0, -108, 584, 380, fontPath)
|
||||
|
||||
|
||||
local filterHintText = filterSection:CreateFontString(nil, "OVERLAY")
|
||||
filterHintText:SetFont(fontPath, 10, "OUTLINE")
|
||||
filterHintText:SetPoint("TOPRIGHT", filterSection, "TOPRIGHT", -16, -8)
|
||||
filterHintText:SetJustifyH("RIGHT")
|
||||
filterHintText:SetText("勾选即等于接收该频道或类型消息")
|
||||
filterHintText:SetTextColor(0.78, 0.72, 0.58)
|
||||
|
||||
CreateCfgButton(filterSection, "全选", 16, -26, 60, 20, function()
|
||||
for _, def in ipairs(FILTER_DEFS) do
|
||||
SFrames.Chat:SetActiveTabFilter(def.key, true)
|
||||
@@ -4130,6 +4150,7 @@ function SFrames.Chat:EnsureConfigFrame()
|
||||
end)
|
||||
|
||||
self:ShowConfigPage(self.configActivePage or "window")
|
||||
panel:Hide()
|
||||
end
|
||||
|
||||
function SFrames.Chat:OpenConfigFrame(pageKey)
|
||||
@@ -6465,6 +6486,8 @@ function SFrames.Chat:Initialize()
|
||||
end
|
||||
translateEvFrame:SetScript("OnEvent", function()
|
||||
if not (SFrames and SFrames.Chat) then return end
|
||||
-- 翻译总开关关闭时直接跳过,避免无用开销
|
||||
if SFramesDB and SFramesDB.Chat and SFramesDB.Chat.translateEnabled == false then return end
|
||||
local filterKey = GetTranslateFilterKeyForEvent(event)
|
||||
if not filterKey then return end
|
||||
local messageText = arg1
|
||||
@@ -6712,8 +6735,7 @@ function SFrames.Chat:Initialize()
|
||||
if not SFrames.Chat:GetTabChannelFilter(matchedTabIdx, chanName) then
|
||||
return
|
||||
end
|
||||
local shouldTranslate = SFrames.Chat:GetTabChannelTranslateFilter(matchedTabIdx, chanName)
|
||||
if shouldTranslate then
|
||||
if SFrames.Chat:ShouldAutoTranslateForTab(matchedTabIdx, "channel", chanName) then
|
||||
local cleanText = CleanTextForTranslation(text)
|
||||
cleanText = string.gsub(cleanText, "^%[.-%]%s*", "")
|
||||
local _, _, senderName = string.find(cleanText, "^%[([^%]]+)%]:%s*")
|
||||
|
||||
Reference in New Issue
Block a user