Commit c9bb4d18 authored by Slofu's avatar Slofu

refactored, backdrop fix

parent c7298935
......@@ -2,3 +2,4 @@ Thumbs.db
Desktop.ini
*.ps1
.pkgmeta
.vs/
\ No newline at end of file
......@@ -3,30 +3,40 @@ local AS = unpack(AddOnSkins)
if not AS:CheckAddOn('FlyPlateBuffs') then return end
function AS:FPB()
local C_NamePlate_GetNamePlateForUnit = C_NamePlate.GetNamePlateForUnit
local function skinIconButton(Button) AS:SkinTexture(Button.texture) end
local function getIconsFromFrame(frame)
if not frame then return end
if not frame.fPBiconsFrame then return end
if not frame.fPBiconsFrame.iconsFrame then return end
for i = 1, #frame.fPBiconsFrame.iconsFrame do
if not frame.fPBiconsFrame.iconsFrame[i] then return end
skinIconButton(frame.fPBiconsFrame.iconsFrame[i])
end
end
local testframe = CreateFrame("Frame")
testframe:RegisterEvent("UNIT_AURA")
testframe:SetScript("OnEvent", function(self, event, ...)
if event == "UNIT_AURA" then
if strmatch((...), "nameplate%d+") then
getIconsFromFrame(C_NamePlate_GetNamePlateForUnit(...))
end
end
end)
local C_NamePlate_GetNamePlateForUnit = C_NamePlate.GetNamePlateForUnit
local function skinNameplateButton(Button)
--remove fPB stuff
Button.durationBg:SetTexture('')
Button.border:SetTexture('')
--texture
AS:SkinTexture(Button.texture)
Button.texture:SetInside(Button, 0, 0)
AS:CreateBackdrop(Button)
end
local function getButtonsFromNameplate(nameplate)
if not nameplate then return end
if not nameplate.fPBiconsFrame then return end
if not nameplate.fPBiconsFrame.iconsFrame then return end
for i = 1, #nameplate.fPBiconsFrame.iconsFrame do
if not nameplate.fPBiconsFrame.iconsFrame[i] then return end
skinNameplateButton(nameplate.fPBiconsFrame.iconsFrame[i])
end
end
local testframe = CreateFrame("Frame")
testframe:RegisterEvent("UNIT_AURA")
testframe:SetScript("OnEvent", function(self, event, ...)
if event == "UNIT_AURA" then
if strmatch((...), "nameplate%d+") then
getButtonsFromNameplate(C_NamePlate_GetNamePlateForUnit(...))
end
end
end)
end
AS:RegisterSkin('FlyPlateBuffs', AS.FPB)
\ No newline at end of file
AS:RegisterSkin('FlyPlateBuffs', AS.FPB)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment