Originally Posted by Phanx
I'm not sure that code is doing what you think it's doing.... you're calling Enable and Disable on the boss frames, which is (a) not what I think anyone in this thread is trying to do, and (b) not allowed in combat, so you can't just do it when the frames are hidden/shown, since you may be in combat when that happens.
|
So by looking at all the codes posted (BTW thank you to you code gurus for helping) it seems that this setup should give me the results I am looking for.
Lua Code:
-- Main Code provided by Zork from WoWInterface
local ObjectiveTracker = CreateFrame("Frame", nil, UIParent)
ObjectiveTrackerFrame:SetParent(ObjectiveTracker)
--Animation Fade In Code
ObjectiveTracker.fadeIn = ObjectiveTracker:CreateAnimationGroup()
ObjectiveTracker.fadeIn.anim = ObjectiveTracker.fadeIn:CreateAnimation("Alpha")
ObjectiveTracker.fadeIn.anim:SetDuration(0.8)
ObjectiveTracker.fadeIn.anim:SetSmoothing("IN")
ObjectiveTracker.fadeIn.anim:SetChange(1)
ObjectiveTracker.fadeIn:HookScript("OnFinished", function(self)
self:GetParent():SetAlpha(1)
end)
--Animation Fade Out Code
ObjectiveTracker.fadeOut = ObjectiveTracker:CreateAnimationGroup()
ObjectiveTracker.fadeOut.anim = ObjectiveTracker.fadeOut:CreateAnimation("Alpha")
ObjectiveTracker.fadeOut.anim:SetDuration(0.8)
ObjectiveTracker.fadeOut.anim:SetSmoothing("OUT")
ObjectiveTracker.fadeOut.anim:SetChange(-1)
ObjectiveTracker.fadeOut:HookScript("OnFinished", function(self)
self:GetParent():SetAlpha(0)
--hide frame
self:GetParent():Hide()
end)
-- Show Tracker Function
function ObjectiveTracker:Enable()
self:Show()
self.fadeIn:Play()
end
-- Hide Tracker Function
function ObjectiveTracker:Disable()
self.fadeOut:Play()
end
function ObjectiveTracker:OnEvent(event)
if event == "INSTANCE_ENCOUNTER_ENGAGE_UNIT" then
self:Disable()
elseif event == "PLAYER_REGEN_ENABLED" then
self:Enable()
end
end
ObjectiveTracker:RegisterEvent("PLAYER_REGEN_ENABLED")
ObjectiveTracker:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
ObjectiveTracker:SetScript("OnEvent",ObjectiveTracker.OnEvent)
From what im gathering the event
INSTANCE_ENCOUNTER_ENGAGE_UNIT should fire when any Boss Frame is toggled. I could not find a event that fired after the boss frame disappears (that would be to easy) so going with Zork's idea I used
PLAYER_REGEN_ENABLED to show the tracker.
Thanks to all that helped me with this.
Coke