/
Bubbles.lua
46 lines (42 loc) · 1.43 KB
/
Bubbles.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
local T, C, L, _ = unpack(select(2, ...))
if C.chat.bubbles ~= true then return end
----------------------------------------------------------------------------------------
-- ChatBubbles skin(by Haleth)
----------------------------------------------------------------------------------------
local f = CreateFrame("Frame", nil, UIParent)
local total = 0
local numKids = 0
local function styleBubble(frame)
for i = 1, frame:GetNumRegions() do
local region = select(i, frame:GetRegions())
if region:GetObjectType() == "Texture" then
region:SetTexture(nil)
end
end
frame:SetBackdrop({
bgFile = C.media.blank, edgeFile = C.media.blank, edgeSize = T.noscalemult,
insets = {left = -T.noscalemult, right = -T.noscalemult, top = -T.noscalemult, bottom = -T.noscalemult}
})
frame:SetBackdropColor(unpack(C.media.overlay_color))
frame:SetBackdropBorderColor(unpack(C.media.border_color))
frame:SetClampedToScreen(false)
frame:SetFrameStrata("BACKGROUND")
frame:SetFrameLevel(3)
end
f:SetScript("OnUpdate", function(self, elapsed)
total = total + elapsed
if total > 0.1 then
total = 0
local newNumKids = WorldFrame:GetNumChildren()
if newNumKids ~= numKids then
for i = numKids + 1, newNumKids do
local frame = select(i, WorldFrame:GetChildren())
local b = frame:GetBackdrop()
if b and b.bgFile == [[Interface\Tooltips\ChatBubble-Background]] then
styleBubble(frame)
end
end
numKids = newNumKids
end
end
end)