Thread Tools Display Modes
04-08-12, 04:17 AM   #21
lerb
A Frostmaul Preserver
 
lerb's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 264
I have a module in my UI that skins the mirror bar and the BG start timer bar.

Here's the code used for the BG timer, hope it can point you in the right direction;

Lua Code:
  1. -- skinning
  2. local function SkinIt(bar)
  3.     for i=1, bar:GetNumRegions() do
  4.         local region = select(i, bar:GetRegions())
  5.         if region:GetObjectType() == "Texture" then
  6.             region:SetTexture(nil)
  7.         elseif region:GetObjectType() == "FontString" then
  8.             region:SetFont(LeUI.media.font, 11, LeUI.media.fontflag)
  9.         end
  10.     end
  11.     bar:SetScale(1)
  12.     bar:SetSize(160, 16)   
  13.     bar:SetStatusBarTexture(LeUI.media.texture)
  14.    
  15.     -- !beautycase border
  16.     CreateBorderLight(bar, LeUI.media.bordersize, LeUI.bordercolor, LeUI.bordercolor, LeUI.bordercolor, 2)
  17.    
  18.     -- backdrop
  19.     local backdrop = select(1, bar:GetRegions())
  20.     backdrop:SetTexture(LeUI.media.blank)
  21.     backdrop:SetVertexColor(unpack(LeUI.media.backdropcolor))
  22.     backdrop:SetAllPoints(bar)
  23. end
  24.  
  25. local function SkinBlizzTimer(self, event)
  26.     for _, b in pairs(TimerTracker.timerList) do
  27.         if not b["bar"].skinned then
  28.             SkinIt(b["bar"])
  29.             b["bar"].skinned = true
  30.         end
  31.     end
  32. end
  33.  
  34. local bgtimer = CreateFrame("Frame")
  35. bgtimer:RegisterEvent("START_TIMER")
  36. bgtimer:SetScript("OnEvent", SkinBlizzTimer)
  Reply With Quote
04-08-12, 12:52 PM   #22
MiRai
A Warpwood Thunder Caller
Join Date: Jul 2011
Posts: 96
Thanks for the replies and the suggestions. Yesterday and today I've been working with Choonster over on the WoW Macro & UI forum, and he was able to get the TimerTrackerTimer bars to skin correctly using this code:

Lua Code:
  1. local function SkinBar(barName)
  2.     local bar;
  3.         if type(barName) == "string" then
  4.         bar = _G[barName]
  5.     else
  6.         bar = barName
  7.         barName = bar:GetName()
  8.     end
  9.     bar:SetParent(UIParent)
  10.     bar:SetScale(1)
  11.     bar:SetHeight(16)
  12.     bar:SetWidth(280)
  13.     bar:SetBackdropColor(0.1, 0.1, 0.1)
  14.    
  15.     for _, region in pairs({ bar:GetRegions() }) do
  16.         if region.GetTexture and region:GetTexture() == "SolidTexture" then
  17.             region:Hide()
  18.         end
  19.     end
  20.    
  21.     local border = _G[barName.."Border"] or _G[barName.."StatusBarBorder"]
  22.     border:Hide()
  23.    
  24.     local background = bar:CreateTexture(barName.."Background", "BACKGROUND")
  25.     background:SetTexture(cfg.statusbar_texture)
  26.     background:SetAllPoints(bar)
  27.     background:SetVertexColor(.15,.15,.15,.75)
  28.    
  29.     local statusbar = _G[barName.."StatusBar"]
  30.     statusbar:SetAllPoints(bar)
  31.    
  32.     local text = _G[barName.."Text"] or _G[barName .."StatusBarTimeText"]
  33.     text:SetFont(cfg.font, 14, "THINOUTLINE")
  34.     text:ClearAllPoints()
  35.     text:SetPoint("CENTER", statusbar, 0, 1)
  36.    
  37.     local glow = CreateFrame("Frame", nil, bar)
  38.     glow:SetFrameLevel(0)
  39.     glow:SetPoint("TOPLEFT", -5, 5)
  40.     glow:SetPoint("BOTTOMRIGHT", 5, -5)
  41.     lib.gen_backdrop(glow)
  42. end
  43.  
  44. -- mirror castbar!
  45. lib.gen_mirrorcb = function(f)
  46.     for _, barName in pairs({"MirrorTimer1", "MirrorTimer2", "MirrorTimer3"}) do
  47.         SkinBar(barName)
  48.     end
  49. end
  50.  
  51. -- timers
  52. TimerTracker:HookScript("OnEvent", function(self, event, ...)
  53.     if event == "START_TIMER" then
  54.         for i, timer in ipairs(self.timerList) do
  55.             SkinBar(timer)
  56.         end
  57.     end
  58. end)

However, once the large digit 10, 9, 8, 7, etc countdown begins, the TimerTrackerTimer bar does not automatically hide itself and stays visible until a /reload of the UI.

He's not seeing a reason why the TimerTrackerTimer bar isn't hiding itself and so, I'm asking here again to see if anyone sees anything funny or has a suggestion.

Thanks!
  Reply With Quote
04-10-12, 09:20 AM   #23
MiRai
A Warpwood Thunder Caller
Join Date: Jul 2011
Posts: 96
Originally Posted by Irongunner View Post
I would also be interested in some info on how to style the battleground countdown-to-start timer, does someone have a hint?
Choonster from the WoW Macro & UI forum finally did get this figured out after a few attempts.

Find the following code around line 570 in lib.lua:
Lua Code:
  1. lib.gen_mirrorcb = function(f)
  2.     for _, bar in pairs({'MirrorTimer1','MirrorTimer2','MirrorTimer3',}) do
  3.       for i, region in pairs({_G[bar]:GetRegions()}) do
  4.         if (region.GetTexture and region:GetTexture() == 'SolidTexture') then
  5.           region:Hide()
  6.         end
  7.       end
  8.       _G[bar..'Border']:Hide()
  9.       _G[bar]:SetParent(UIParent)
  10.       _G[bar]:SetScale(1)
  11.       _G[bar]:SetHeight(16)
  12.       _G[bar]:SetWidth(280)
  13.       _G[bar]:SetBackdropColor(.1,.1,.1)
  14.       _G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar])
  15.       _G[bar..'Background']:SetTexture(cfg.statusbar_texture)
  16.       _G[bar..'Background']:SetAllPoints(bar)
  17.       _G[bar..'Background']:SetVertexColor(.15,.15,.15,.75)
  18.       _G[bar..'Text']:SetFont(cfg.font, 14, "THINOUTLINE")
  19.       _G[bar..'Text']:ClearAllPoints()
  20.       _G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1)
  21.       _G[bar..'StatusBar']:SetAllPoints(_G[bar])
  22.       --glowing borders
  23.       local h = CreateFrame("Frame", nil, _G[bar])
  24.       h:SetFrameLevel(0)
  25.       h:SetPoint("TOPLEFT",-5,5)
  26.       h:SetPoint("BOTTOMRIGHT",5,-5)
  27.       lib.gen_backdrop(h)
  28.     end
  29.   end


And replace it with this:
Lua Code:
  1. local function SkinBar(barName)
  2.     local bar;
  3.     if type(barName) == "string" then
  4.         bar = _G[barName]
  5.     else
  6.         bar = barName
  7.         barName = bar:GetName()
  8.     end
  9.     bar:SetParent(UIParent)
  10.     bar:SetScale(1)
  11.     bar:SetHeight(16)
  12.     bar:SetWidth(280)
  13.     bar:SetBackdropColor(0.1, 0.1, 0.1)
  14.    
  15.     for _, region in pairs({ bar:GetRegions() }) do
  16.         if region.GetTexture and region:GetTexture() == "SolidTexture" then
  17.             region:Hide()
  18.         end
  19.     end
  20.    
  21.     local border = _G[barName.."Border"] or _G[barName.."StatusBarBorder"]
  22.     border:Hide()
  23.    
  24.     local background = (bar.bar or bar):CreateTexture(barName.."Background", "BACKGROUND")
  25.     background:SetTexture(cfg.statusbar_texture)
  26.     background:SetAllPoints(bar)
  27.     background:SetVertexColor(.15,.15,.15,.75)
  28.    
  29.     local statusbar = _G[barName.."StatusBar"]
  30.     statusbar:SetAllPoints(bar)
  31.    
  32.     local text = _G[barName.."Text"] or _G[barName .."StatusBarTimeText"]
  33.     text:SetFont(cfg.font, 14, "THINOUTLINE")
  34.     text:ClearAllPoints()
  35.     text:SetPoint("CENTER", statusbar, 0, 1)
  36.    
  37.     local glow = CreateFrame("Frame", nil, (bar.bar or bar))
  38.     glow:SetFrameLevel(0)
  39.     glow:SetPoint("TOPLEFT", -5, 5)
  40.     glow:SetPoint("BOTTOMRIGHT", 5, -5)
  41.     lib.gen_backdrop(glow)
  42. end
  43.  
  44. -- mirror castbar!
  45. lib.gen_mirrorcb = function(f)
  46.     for _, barName in pairs({"MirrorTimer1", "MirrorTimer2", "MirrorTimer3"}) do
  47.         SkinBar(barName)
  48.     end
  49. end
  50.  
  51. -- timers
  52. TimerTracker:HookScript("OnEvent", function(self, event, ...)
  53.     if event == "START_TIMER" then
  54.         for i, timer in ipairs(self.timerList) do
  55.             SkinBar(timer)
  56.         end
  57.     end
  58. end)

Thanks again to everyone who was willing to give an attempt at helping me with this.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Questions Regarding oUF_Fail


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