NDui

NDui

359k Downloads

AuroraClassic几个自定义API,希望能提供一点小帮助。

VIKINGYFY opened this issue · 0 comments

commented

1、清除一些材质。
function F:CleanTextures(noIcon)
--if self.SetCheckedTexture then self:SetCheckedTexture("") end
if self.SetDisabledTexture then self:SetDisabledTexture("") end
if self.SetHighlightTexture then self:SetHighlightTexture("") end
if self.SetNormalTexture then self:SetNormalTexture("") end
if self.SetPushedTexture then self:SetPushedTexture("") end

local name = self:GetName()

local Left = self.Left or (name and _G[name.."Left"])
if Left then Left:Hide() end
local Right = self.Right or (name and _G[name.."Right"])
if Right then Right:Hide() end
local Top = self.Top or (name and _G[name.."Top"])
if Top then Top:Hide() end
local Bottom = self.Bottom or (name and _G[name.."Bottom"])
if Bottom then Bottom:Hide() end
local Middle = self.Middle or (name and (_G[name.."Middle"] or _G[name.."Mid"]))
if Middle then Middle:Hide() end
local TopLeft = self.TopLeft or (name and _G[name.."TopLeft"])
if TopLeft then TopLeft:Hide() end
local TopMiddle = self.TopMiddle or (name and (_G[name.."TopMiddle"] or _G[name.."TopMid"]))
if TopMiddle then TopMiddle:Hide() end
local TopRight = self.TopRight or (name and _G[name.."TopRight"])
if TopRight then TopRight:Hide() end
local MiddleLeft = self.MiddleLeft or (name and _G[name.."MiddleLeft"])
if MiddleLeft then MiddleLeft:Hide() end
local MiddleMiddle = self.MiddleMiddle or (name and (_G[name.."MiddleMiddle"] or _G[name.."MiddleMid"]))
if MiddleMiddle then MiddleMiddle:Hide() end
local MiddleRight = self.MiddleRight or (name and _G[name.."MiddleRight"])
if MiddleRight then MiddleRight:Hide() end
local BottomLeft = self.BottomLeft or (name and _G[name.."BottomLeft"])
if BottomLeft then BottomLeft:Hide() end
local BottomMiddle = self.BottomMiddle or (name and (_G[name.."BottomMiddle"] or _G[name.."BottomMid"]))
if BottomMiddle then BottomMiddle:Hide() end
local BottomRight = self.BottomRight or (name and _G[name.."BottomRight"])
if BottomRight then BottomRight:Hide() end

local track = self.Track or self.trackBG or self.Background or (name and (_G[name.."Track"] or _G[name.."BG"]))
if track then track:Hide() end
local top = self.ScrollBarTop or self.ScrollUpBorder
if top then top:Hide() end
local middle = self.ScrollBarMiddle or self.Border
if middle then middle:Hide() end
local bottom = self.ScrollBarBottom or self.ScrollDownBorder
if bottom then bottom:Hide() end

local bd = self.Border or self.border
if bd then bd:Hide() end

if noIcon then
	local ic = self.icon or self.Icon
	if ic then ic:Hide() end
end

end

2、美化HighlightTexture或者其他一些材质。
function F:ReskinTexture(relativeTo, classColor, isBorder)
if not self then return end

local r, g, b = 1, 1, 1
if classColor then r, g, b = cr, cg, cb end

local mult = C.mult
if isBorder then mult = -C.mult end

local tex
if self.SetHighlightTexture then
	self:SetHighlightTexture(C.media.bdTex)
	tex = self:GetHighlightTexture()
else
	tex = self
	tex:SetTexture(C.media.bdTex)
	if isBorder then
		tex.SetTexture = F.dummy
		tex:SetDrawLayer("BACKGROUND")
	end
end

if not isBorder then
	tex:SetColorTexture(r, g, b, .25)
end

tex:SetPoint("TOPLEFT", relativeTo, mult, -mult)
tex:SetPoint("BOTTOMRIGHT", relativeTo, -mult, mult)

end

3、美化StatusBar,大部分情况都适用。
function F:ReskinStatusBar(classColor, stripTex)
F.StripTextures(self, stripTex)
F.CleanTextures(self, true)

self:SetStatusBarTexture(C.media.normTex)
if classColor then self:SetStatusBarColor(cr*.8, cg*.8, cb*.8) end

local lvl = self:GetFrameLevel()
local bg = F.CreateBDFrame(self, .25)
bg:SetFrameLevel(lvl == 0 and 1 or lvl - 1)

end