From 6d572a52f540a17d2509595d7d2df23c28e47ff6 Mon Sep 17 00:00:00 2001 From: Christopher Tse Date: Sat, 23 May 2020 17:34:03 +1000 Subject: [PATCH] Fixed an issue where the chat bubbles remained on screen during movies and cinematics --- ChatBubblePool.lua | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/ChatBubblePool.lua b/ChatBubblePool.lua index c1cc6c3..dbcad0b 100644 --- a/ChatBubblePool.lua +++ b/ChatBubblePool.lua @@ -111,6 +111,26 @@ local function subtractVector(a, b) return { x=a.x - b.x, y=a.y - b.y}; end +local function closeBubbles() + for _, bubble in pairs(pool) do + closeBubble(bubble); + end +end + +local function hideBubbles() + for _, bubble in pairs(pool) do + bubble:Hide() + end +end + +local function showBubbles() + for _, bubble in pairs(pool) do + if not bubble.isAvailable then + bubble:Show() + end + end +end + local function moveTail(tail) --Note: Since the chat bubble is anchored to the WorldFrame, we shouldn't adjust for UIParent's scale local cursorX, cursorY = GetCursorPosition(); @@ -403,4 +423,20 @@ function ChatBubblePool.getChatBubble() newChatBubble.ResetNameColor = function(self) self:SetNameColor(origR,origG,origB); end; return newChatBubble -end \ No newline at end of file +end + +local function doEvent(self, event, ...) + if event == "PLAY_MOVIE" then + closeBubbles() + elseif event == "CINEMATIC_START" then + hideBubbles() + elseif event == "CINEMATIC_STOP" then + showBubbles() + end +end + +local frame = CreateFrame("FRAME","ChatBubbleEventHandler"); +frame:RegisterEvent("PLAY_MOVIE"); +frame:RegisterEvent("CINEMATIC_START"); +frame:RegisterEvent("CINEMATIC_STOP"); +frame:SetScript("OnEvent",doEvent); \ No newline at end of file -- 1.7.9.5