Hi all,
I've been a user of kui nameplate, but have recently decided to work on my private nameplate addon which I honestly don't know why LOL..........
Anyways!
I have started to working on media updates like font, statusbar texture, etc as my first job.
Everything is working fine except from the statusbar texture of castbar.
Please have a look at the code.
Lua Code:
------------------------------------------
-- Variable
------------------------------------------
local LSM = LibStub("LibSharedMedia-3.0");
local fontA = LSM:Fetch("font", "fontA");
local textureB = LSM:Fetch("statusbar", "textureB");
local UpdateMedia;
local CreateAuraFrame;
local CreateHealthText;
local OnEvent;
------------------------------------------
-- Function
------------------------------------------
function UpdateMedia(nameplate)
local unitFrame = nameplate.UnitFrame;
local name = unitFrame.name;
if (name) then
name:SetFont(fontA, 14, "OUTLINE");
end
local healthBar = unitFrame.healthBar;
if (healthBar) then
healthBar:SetStatusBarTexture(textureB);
end
local castBar = unitFrame.castBar;
if (castBar) then
castBar:SetStatusBarTexture(textureB);
castBar.Text:SetFont(fontA, 12, "OUTLINE");
end
end
function OnEvent(self, event, ...)
if (event == "NAME_PLATE_CREATED") then
local nameplate = ...;
if (nameplate and nameplate.UnitFrame) then
UpdateMedia(nameplate);
-- CreateAuraFrame(nameplate);
-- CreateHealthText(nameplate);
end
end
end
local handler = CreateFrame("Frame");
handler:RegisterEvent("NAME_PLATE_CREATED");
handler:RegisterEvent("NAME_PLATE_UNIT_ADDED");
handler:RegisterEvent("NAME_PLATE_UNIT_REMOVED");
handler:SetScript("OnEvent", OnEvent);
It looks like Blizzard's code is keep updating the castbar's texture which I dug into, but failed
Could anyone please correct me if I am getting it wrong?
As always, thank you in advance!