From 97a11f994c835b94cacc2cc92f7ce7cb8ded2fa3 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 7 Jan 2018 14:01:24 +0100 Subject: [PATCH] bubbles: move processing into function --- modules/bubbles.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/bubbles.lua b/modules/bubbles.lua index 0f386959..40e66126 100644 --- a/modules/bubbles.lua +++ b/modules/bubbles.lua @@ -24,6 +24,15 @@ pfUI:RegisterModule("bubbles", function () return f:GetRegions():GetTexture() == "Interface\\Tooltips\\ChatBubble-Background" end + function pfUI.bubbles:ProcessBubble(f) + f.text:Hide() + f.text:SetFont(pfUI.font_default, tonumber(C.global.font_size) * UIParent:GetScale(), "OUTLINE") + local r,g,b,a = f.text:GetTextColor() + f.frame.text:SetText(f.text:GetText()) + f.frame.text:SetTextColor(r,g,b,a) + f.frame.backdrop:SetBackdropBorderColor(r,g,b,a) + end + function pfUI.bubbles:ScanBubbles() local childs = { WorldFrame:GetChildren() } for _, f in pairs(childs) do @@ -51,19 +60,10 @@ pfUI:RegisterModule("bubbles", function () f.frame.backdrop:SetPoint("TOPLEFT", f, "TOPLEFT", -10, -10) f.frame.backdrop:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", 10, 10) - f.text:Hide() - f.text:SetFont(pfUI.font_default, tonumber(C.global.font_size) * UIParent:GetScale(), "OUTLINE") - local r,g,b,a = f.text:GetTextColor() - f.frame.text:SetText(f.text:GetText()) - f.frame.text:SetTextColor(r,g,b,a) - f.frame.backdrop:SetBackdropBorderColor(r,g,b,a) + pfUI.bubbles:ProcessBubble(f) f:SetScript("OnShow", function() - this.text:Hide() - local r,g,b,a = this.text:GetTextColor() - this.frame.text:SetText(this.text:GetText()) - this.frame.text:SetTextColor(r,g,b,a) - this.frame.backdrop:SetBackdropBorderColor(r,g,b,a) + pfUI.bubbles:ProcessBubble(this) end) end end