From 7b70d48d70a784e7a4d98b7b5aaacff1e56e32e2 Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Sun, 31 Dec 2017 04:07:16 +0300 Subject: [PATCH] 4 --- 2/3/4/5/6/7/ElvUI/Core/Commands.lua | 2 +- 2/3/4/5/6/7/ElvUI/Core/Math.lua | 27 +++++++++---------- 2/3/4/5/6/7/ElvUI/Libraries/oUF/templates.lua | 2 -- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/2/3/4/5/6/7/ElvUI/Core/Commands.lua b/2/3/4/5/6/7/ElvUI/Core/Commands.lua index 01e640b..c8b9078 100644 --- a/2/3/4/5/6/7/ElvUI/Core/Commands.lua +++ b/2/3/4/5/6/7/ElvUI/Core/Commands.lua @@ -64,7 +64,7 @@ function E:Grid(msg) E.db.gridSize = msg E:Grid_Show() else - if(EGrid) then + if EGrid then E:Grid_Hide() else E:Grid_Show() diff --git a/2/3/4/5/6/7/ElvUI/Core/Math.lua b/2/3/4/5/6/7/ElvUI/Core/Math.lua index 0ef4883..cc0de75 100644 --- a/2/3/4/5/6/7/ElvUI/Core/Math.lua +++ b/2/3/4/5/6/7/ElvUI/Core/Math.lua @@ -253,32 +253,31 @@ end local waitTable = {} local waitFrame -function E:Delay(delay, func, arg) - if type(delay) ~= "number" or type(func) ~= "function" then +function E:Delay(delay, func, ...) + if (type(delay) ~= "number") or (type(func) ~= "function") then return false end if waitFrame == nil then waitFrame = CreateFrame("Frame","WaitFrame", E.UIParent) - waitFrame:SetScript("OnUpdate", function () - local elapse = arg1 - local count = getn(waitTable) - local i = 1 + waitFrame:SetScript("onUpdate", function() + local waitRecord, waitDelay, waitFunc, waitParams + local i, count = 1, getn(waitTable) while i <= count do - local waitRecord = tremove(waitTable, i) - local d = tremove(waitRecord, 1) - local f = tremove(waitRecord, 1) - local p = tremove(waitRecord, 1) - if d > elapse then - tinsert(waitTable, i, {d-elapse, f, p}) + waitRecord = tremove(waitTable, i) + waitDelay = tremove(waitRecord, 1) + waitFunc = tremove(waitRecord, 1) + waitParams = tremove(waitRecord, 1) + if waitDelay > arg1 then + tinsert(waitTable, i, {waitDelay - arg1, waitFunc, waitParams}) i = i + 1 else count = count - 1 - f(unpack(p)) + waitFunc(unpack(waitParams)) end end end) end - tinsert(waitTable, {delay, func, {arg}}) + tinsert(waitTable, {delay, func, arg}) return true end diff --git a/2/3/4/5/6/7/ElvUI/Libraries/oUF/templates.lua b/2/3/4/5/6/7/ElvUI/Libraries/oUF/templates.lua index bb42c6f..6a03772 100644 --- a/2/3/4/5/6/7/ElvUI/Libraries/oUF/templates.lua +++ b/2/3/4/5/6/7/ElvUI/Libraries/oUF/templates.lua @@ -16,8 +16,6 @@ local function updateUnitWatch(frame) if exists then if not frame:IsShown() then frame:Show() - else - -- frame:UpdateAllElements('RefreshUnit') end elseif frame:IsShown() then frame:Hide()