Thread Tools Display Modes
Prev Previous Post   Next Post Next
10-31-18, 12:35 AM   #1
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Nameplate's castbar won't change its texture

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:
  1. ------------------------------------------
  2. -- Variable
  3. ------------------------------------------
  4.  
  5. local LSM = LibStub("LibSharedMedia-3.0");
  6. local fontA = LSM:Fetch("font", "fontA");
  7. local textureB = LSM:Fetch("statusbar", "textureB");
  8.  
  9. local UpdateMedia;
  10. local CreateAuraFrame;
  11. local CreateHealthText;
  12.  
  13. local OnEvent;
  14.  
  15. ------------------------------------------
  16. -- Function
  17. ------------------------------------------
  18.  
  19. function UpdateMedia(nameplate)
  20.     local unitFrame = nameplate.UnitFrame;
  21.  
  22.     local name = unitFrame.name;
  23.     if (name) then
  24.         name:SetFont(fontA, 14, "OUTLINE");
  25.     end
  26.  
  27.     local healthBar = unitFrame.healthBar;
  28.     if (healthBar) then
  29.         healthBar:SetStatusBarTexture(textureB);
  30.     end
  31.  
  32.     local castBar = unitFrame.castBar;
  33.     if (castBar) then
  34.         castBar:SetStatusBarTexture(textureB);
  35.  
  36.         castBar.Text:SetFont(fontA, 12, "OUTLINE");
  37.     end
  38. end
  39.  
  40. function OnEvent(self, event, ...)
  41.     if (event == "NAME_PLATE_CREATED") then
  42.         local nameplate = ...;
  43.         if (nameplate and nameplate.UnitFrame) then
  44.             UpdateMedia(nameplate);
  45.             -- CreateAuraFrame(nameplate);
  46.             -- CreateHealthText(nameplate);
  47.         end
  48.     end
  49. end
  50.  
  51. local handler = CreateFrame("Frame");
  52. handler:RegisterEvent("NAME_PLATE_CREATED");
  53. handler:RegisterEvent("NAME_PLATE_UNIT_ADDED");
  54. handler:RegisterEvent("NAME_PLATE_UNIT_REMOVED");
  55. 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!

Last edited by Lyak : 10-31-18 at 12:37 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Nameplate's castbar won't change its texture

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off