View Single Post
08-07-13, 01:02 AM   #52
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
OnLoad -- Everything class coloured
Code:
local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)end
OnClick -- Set self to white, set other tabs class coloured, show/hide chat frames:
Code:
if pressed then
    return
end

local _, Class = UnitClass("player")
local Color = RAID_CLASS_COLORS[Class]
if not self.clicked then
    self.clicked = true
    self.text:SetTextColor(1, 1, 1)
    
--Change per tab/button
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab2.clicked = false
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.clicked = false
end
OnEnter -- set white no matter what
Code:
self.text:SetTextColor(1, 1, 1)
OnLeave -- if clicked set to white else class coloured (changed for clarity)
Code:
if self.clicked then
    self.text:SetTextColor(1,1,1)
else -- condition set in OnClick of other tabs
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-07-13 at 01:50 AM.
  Reply With Quote