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