修改优化等

This commit is contained in:
rucky
2026-03-18 02:01:36 +08:00
parent 2a55dd6dad
commit 923a1f9ce2
15 changed files with 1578 additions and 371 deletions

View File

@@ -333,6 +333,18 @@ local function CreateActionBtn(parent, text, w)
return btn
end
--------------------------------------------------------------------------------
-- Quality cache (lazy per-row instead of bulk tooltip scan)
--------------------------------------------------------------------------------
local qualityCache = {}
local function GetCachedServiceQuality(index)
if qualityCache[index] ~= nil then return qualityCache[index] end
local q = GetServiceQuality(index)
qualityCache[index] = q or false
return q
end
--------------------------------------------------------------------------------
-- List Row Factory (reusable for both headers and services)
--------------------------------------------------------------------------------
@@ -530,8 +542,9 @@ local function CreateListRow(parent, idx)
self.icon:SetVertexColor(T.passive[1], T.passive[2], T.passive[3])
end
local qc = QUALITY_COLORS[svc.quality]
if qc and svc.quality and svc.quality >= 2 then
local quality = GetCachedServiceQuality(svc.index)
local qc = QUALITY_COLORS[quality]
if qc and quality and quality >= 2 then
self.qualGlow:SetVertexColor(qc[1], qc[2], qc[3])
self.qualGlow:Show()
self.iconFrame:SetBackdropBorderColor(qc[1], qc[2], qc[3], 1)
@@ -607,7 +620,6 @@ local function BuildDisplayList()
name = name,
subText = subText or "",
category = category or "unavailable",
quality = GetServiceQuality(i),
})
end
end
@@ -1172,19 +1184,22 @@ function TUI:Initialize()
selectedIndex = nil
currentFilter = "all"
collapsedCats = {}
qualityCache = {}
local npcName = UnitName("npc") or "训练师"
if IsTradeskillTrainer and IsTradeskillTrainer() then
npcName = npcName .. " - 专业训练"
end
MainFrame.npcNameFS:SetText(npcName)
MainFrame:Show()
FullUpdate()
BuildDisplayList()
for _, entry in ipairs(displayList) do
if entry.type == "service" then
SelectService(entry.data.index)
selectedIndex = entry.data.index
pcall(SelectTrainerService, entry.data.index)
break
end
end
FullUpdate()
MainFrame._hideBlizzTimer = 0
MainFrame:SetScript("OnUpdate", function()