聊天重做前缓存
This commit is contained in:
@@ -1,12 +1,36 @@
|
||||
SFrames.ToT = {}
|
||||
local _A = SFrames.ActiveTheme
|
||||
|
||||
function SFrames.ToT:ApplyConfig()
|
||||
local f = self.frame
|
||||
if not f then return end
|
||||
SFrames:ApplyStatusBarTexture(f.health, "totHealthTexture", "barTexture")
|
||||
local tex = SFrames:ResolveBarTexture("totHealthTexture", "barTexture")
|
||||
if f.health and f.health.bg then f.health.bg:SetTexture(tex) end
|
||||
if SFrames:IsGradientStyle() then
|
||||
SFrames:ApplyGradientStyle(f.health)
|
||||
if f.hbg then f.hbg:Hide() end
|
||||
if f.health and f.health.bg then f.health.bg:Hide() end
|
||||
else
|
||||
SFrames:RemoveGradientStyle(f.health)
|
||||
if f.hbg then f.hbg:Show() end
|
||||
if f.health and f.health.bg then f.health.bg:Show() end
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.ToT:Initialize()
|
||||
local f = CreateFrame("Button", "SFramesToTFrame", UIParent)
|
||||
f:SetWidth(120)
|
||||
f:SetHeight(25)
|
||||
f:SetPoint("BOTTOMLEFT", SFramesTargetFrame, "BOTTOMRIGHT", 5, 0)
|
||||
|
||||
|
||||
if SFramesDB and SFramesDB.Positions and SFramesDB.Positions["ToTFrame"] then
|
||||
local pos = SFramesDB.Positions["ToTFrame"]
|
||||
f:SetPoint(pos.point or "BOTTOMLEFT", UIParent, pos.relativePoint or "BOTTOMLEFT",
|
||||
pos.xOfs or 0, pos.yOfs or 0)
|
||||
else
|
||||
f:SetPoint("BOTTOMLEFT", SFramesTargetFrame, "BOTTOMRIGHT", 5, 0)
|
||||
end
|
||||
|
||||
f:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
f:SetScript("OnClick", function()
|
||||
if arg1 == "LeftButton" then
|
||||
@@ -24,6 +48,7 @@ function SFrames.ToT:Initialize()
|
||||
hbg:SetPoint("BOTTOMRIGHT", f.health, "BOTTOMRIGHT", 1, -1)
|
||||
hbg:SetFrameLevel(f:GetFrameLevel() - 1)
|
||||
SFrames:CreateUnitBackdrop(hbg)
|
||||
f.hbg = hbg
|
||||
|
||||
f.health.bg = f.health:CreateTexture(nil, "BACKGROUND")
|
||||
f.health.bg:SetAllPoints()
|
||||
@@ -35,7 +60,15 @@ function SFrames.ToT:Initialize()
|
||||
|
||||
self.frame = f
|
||||
f:Hide()
|
||||
|
||||
|
||||
self:ApplyConfig()
|
||||
|
||||
if SFrames.Movers and SFrames.Movers.RegisterMover then
|
||||
SFrames.Movers:RegisterMover("ToTFrame", f, "目标的目标",
|
||||
"BOTTOMLEFT", "SFramesTargetFrame", "BOTTOMRIGHT", 5, 0,
|
||||
nil, { alwaysShowInLayout = true })
|
||||
end
|
||||
|
||||
-- Update loop since targettarget changes don't fire precise events in Vanilla
|
||||
self.updater = CreateFrame("Frame")
|
||||
self.updater.timer = 0
|
||||
|
||||
Reference in New Issue
Block a user