View Single Post
08-06-13, 09:17 PM   #44
Akatosh
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jun 2013
Posts: 84
Hi again, Thanks for the help but now the panels do completely different,

I explain.

OnEnter 1st time, first time OK they turn to white.

Click, dont work as intended, the panels dont hold the text white color.

Onleave, the panels turn the text to class colored again, they dont hold the white color.

I put all the codes of the 3 panels for give you all info as I can, I hope that help you.

I do not understand where I'm failing.

Thanks!!

---------

Panel "PanelGene" (1)

OnLoad

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)
OnEnter

Code:
self.text:SetTextColor(1, 1, 1)
OnLeave

Code:
if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
end
OnClick

Code:
if not self.clicked then
    self.clicked = true
    
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
    
    self.text:SetTextColor(1, 1, 1)
    
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
    
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.clicked = false
end
-----------

Panel PanelLog (2)


OnLoad

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)
OnEnter

Code:
self.text:SetTextColor(1, 1, 1)
OnLeave

Code:
if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
end
OnClick

Code:
if not self.clicked then
    self.clicked = true
    
    ChatFrame2:Show()
    ChatFrame3:Hide()
    ChatFrame1:Hide()
    
    self.text:SetTextColor(1, 1, 1)
    
    local tab1 = kgPanels:FetchFrame("PanelGene")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
    
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab1.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.clicked = false
end
-----------

Panel "PanelTrash" (3)

OnLoad

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)
OnEnter

Code:
self.text:SetTextColor(1, 1, 1)
OnLeave

Code:
if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
end
Onclick

Code:
if not self.clicked then
    self.clicked = true
    
    ChatFrame3:Show()
    ChatFrame1:Hide()
    ChatFrame2:Hide()
    
    self.text:SetTextColor(1, 1, 1)
    
    local tab1 = kgPanels:FetchFrame("PanelGene")
    local tab2 = kgPanels:FetchFrame("PanelLog")
    
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab1.text:SetTextColor(Color.r,Color.g,Color.b)
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.clicked = false
end
Thanks.
  Reply With Quote