View Single Post
07-05-17, 09:04 AM   #4
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Ok so I was able to get the chat bubble to be skinned the way I like it but unfortunately I was not able to get the sender working.

Also it is diabled in raids and instances so no error pops up when in them,

Code:
Code:
------------------------------------------------------------------------
--	 Skin the Chat Bubbles
------------------------------------------------------------------------
local select, pairs = select, pairs
local format = string.format
local CreateFrame = CreateFrame
local C_ChatBubbles_GetAllChatBubbles = C_ChatBubbles.GetAllChatBubbles

local function StyleBubble(frame)
	for i=1, frame:GetNumRegions() do
		local region = select(i, frame:GetRegions())
		if region:GetObjectType() == "Texture" then
			region:SetTexture(nil)
		elseif region:GetObjectType() == "FontString" then
			frame.text = region
		end
	end
	
	frame.text:SetFontObject('SystemFont_Small')
	frame.text:SetJustifyH('LEFT')

	frame:ClearAllPoints()
	frame:SetPoint('TOPLEFT', frame.text, -7, 7)
	frame:SetPoint('BOTTOMRIGHT', frame.text, 7, -7)
	frame:SetBackdrop({
		bgFile = 'Interface\\Tooltips\\UI-Tooltip-Background',
		edgeFile = 'Interface\\Tooltips\\UI-Tooltip-Border',
		tile = true,
		tileSize = 16,
		edgeSize = 12,
		insets = {left=3, right=3, top=3, bottom=3},
	})
	frame:SetBackdropColor(0, 0, 0, 1)
	
	local r, g, b = frame.text:GetTextColor()
	frame:SetBackdropBorderColor(r, g, b, .8)
			
	frame.isSkinned = true
end

local frame = CreateFrame('Frame')
frame.lastupdate = -2 -- wait 2 seconds before hooking frames
local numChildren = 0
frame:SetScript('OnUpdate', function(self, elapsed, guid, name)
	self.lastupdate = self.lastupdate + elapsed
	if (self.lastupdate < .1) then return end
	self.lastupdate = 0	
	
	for _, chatBubble in pairs(C_ChatBubbles_GetAllChatBubbles()) do
		if not chatBubble.isSkinned then				
			StyleBubble(chatBubble)
		end
	end
end)
Hope this helps someone.

Coke
  Reply With Quote