From 6ae46f838f81908bc50df6c1931c4ddb1da13a36 Mon Sep 17 00:00:00 2001 From: Matt Tomasov Date: Sat, 12 Feb 2022 07:34:32 -0500 Subject: [PATCH] Add files via upload --- ClippyAssistBCC.lua | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/ClippyAssistBCC.lua b/ClippyAssistBCC.lua index f56f5d1..e49938f 100644 --- a/ClippyAssistBCC.lua +++ b/ClippyAssistBCC.lua @@ -369,6 +369,36 @@ function ClippyAssist.SetText(msg, duration) end) end +-- Display a speech bubble for the specified duration with an animation. +function ClippyAssist.SetTextAnimation(msg, animation, duration) + balloon.text:SetText(msg) + + -- Resize balloon to fit text. + balloon:SetHeight( + balloon.text:GetHeight() + + balloon.text:GetLineHeight() + + 2 * balloon_corner_size + ) + + -- Position balloon depending on Clippy's location. + ClippyAssist.PositionBalloon() + + -- Display balloon. + balloon:Show() + if (animation) then + SingleAnimation(animation) + else + IdleAnimation("Explain") + end + + -- Set up hiding for balloon. + time_hide_text = GetTime() + duration + C_Timer.After(duration, function() + balloon:Hide() + balloon.text:SetText("") + end) +end + ------------ -- Events -- ------------ @@ -565,7 +595,7 @@ function SlashCmdList.CLIPPY(msg, editBox) end if msg == "-help" or msg == "-h" or msg == "-?" then print("You are currently using Clippy Assist v" .. - GetAddOnMetadata("ClippyAssist", "Version") .. ".") + GetAddOnMetadata("ClippyAssistBCC", "Version") .. ".") print("It looks like you're trying to use Clippy Assist. " .. "Would you like some help with that?") print(" -help: Shows this text.")