跟随版本 0.8.19
This commit is contained in:
@@ -1434,6 +1434,10 @@ function TSUI.ProfNamesMatch(a, b)
|
||||
end
|
||||
|
||||
function TSUI.ScanProfessions()
|
||||
local now = GetTime()
|
||||
if S._profScanTime and (now - S._profScanTime) < 5.0 and table.getn(S.profList) > 0 then
|
||||
return
|
||||
end
|
||||
S.profList = {}
|
||||
if not GetSpellName then return end
|
||||
local seen = {}
|
||||
@@ -1449,6 +1453,7 @@ function TSUI.ScanProfessions()
|
||||
end
|
||||
idx = idx + 1
|
||||
end
|
||||
S._profScanTime = now
|
||||
end
|
||||
|
||||
function TSUI.CreateProfTabs(parent)
|
||||
@@ -1549,6 +1554,32 @@ function TSUI.IsTabSwitching()
|
||||
return S.switchStartTime and (GetTime() - S.switchStartTime) < 1.0
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Update Throttle (batches rapid TRADE_SKILL_UPDATE / CRAFT_UPDATE events)
|
||||
--------------------------------------------------------------------------------
|
||||
local updateThrottleFrame = CreateFrame("Frame")
|
||||
updateThrottleFrame:Hide()
|
||||
updateThrottleFrame._elapsed = 0
|
||||
updateThrottleFrame:SetScript("OnUpdate", function()
|
||||
this._elapsed = this._elapsed + arg1
|
||||
if this._elapsed >= 0.10 then
|
||||
this:Hide()
|
||||
if S.MainFrame and S.MainFrame:IsVisible() then
|
||||
TSUI.UpdateProgressBar()
|
||||
TSUI.FullUpdate()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function TSUI.ScheduleUpdate()
|
||||
updateThrottleFrame._elapsed = 0
|
||||
updateThrottleFrame:Show()
|
||||
end
|
||||
|
||||
function TSUI.CancelScheduledUpdate()
|
||||
updateThrottleFrame:Hide()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Hide Blizzard Frames (module methods)
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -2018,6 +2049,7 @@ function TSUI:Initialize()
|
||||
-- ═══ Events ══════════════════════════════════════════════════════
|
||||
MF:SetScript("OnHide", function()
|
||||
S.switchStartTime = nil
|
||||
TSUI.CancelScheduledUpdate()
|
||||
API.CloseRecipe()
|
||||
if S.currentMode == "tradeskill" then TSUI.CleanupBlizzardTradeSkill()
|
||||
else TSUI.CleanupBlizzardCraft() end
|
||||
@@ -2049,7 +2081,7 @@ function TSUI:Initialize()
|
||||
end)
|
||||
elseif event == "TRADE_SKILL_UPDATE" then
|
||||
if S.MainFrame:IsVisible() and S.currentMode == "tradeskill" then
|
||||
TSUI.UpdateProgressBar(); TSUI.FullUpdate()
|
||||
TSUI.ScheduleUpdate()
|
||||
end
|
||||
elseif event == "TRADE_SKILL_CLOSE" then
|
||||
TSUI.CleanupBlizzardTradeSkill()
|
||||
@@ -2081,7 +2113,7 @@ function TSUI:Initialize()
|
||||
end)
|
||||
elseif event == "CRAFT_UPDATE" then
|
||||
if S.MainFrame:IsVisible() and S.currentMode == "craft" then
|
||||
TSUI.UpdateProgressBar(); TSUI.FullUpdate()
|
||||
TSUI.ScheduleUpdate()
|
||||
end
|
||||
elseif event == "CRAFT_CLOSE" then
|
||||
TSUI.CleanupBlizzardCraft()
|
||||
@@ -2107,14 +2139,20 @@ function TSUI.ResetAndShow()
|
||||
if S.MainFrame.searchBox then S.MainFrame.searchBox:SetText("") end
|
||||
if S.MainFrame.spinner then S.MainFrame.spinner:SetValue(1) end
|
||||
if S.MainFrame.listScroll then S.MainFrame.listScroll:SetVerticalScroll(0) end
|
||||
TSUI.UpdateProgressBar(); S.MainFrame:Show(); TSUI.FullUpdate()
|
||||
TSUI.UpdateScrollbar()
|
||||
TSUI.CancelScheduledUpdate()
|
||||
TSUI.UpdateProgressBar(); S.MainFrame:Show()
|
||||
TSUI.UpdateProfTabs()
|
||||
TSUI.BuildDisplayList()
|
||||
for _, entry in ipairs(S.displayList) do
|
||||
if entry.type == "recipe" then
|
||||
TSUI.SelectRecipe(entry.data.index); break
|
||||
S.selectedIndex = entry.data.index
|
||||
S.craftAmount = 1
|
||||
API.SelectRecipe(entry.data.index)
|
||||
break
|
||||
end
|
||||
end
|
||||
TSUI.FullUpdate()
|
||||
TSUI.UpdateScrollbar()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user