View Single Post
08-28-18, 05:41 AM   #1
Krainz
A Wyrmkin Dreamwalker
Join Date: Oct 2016
Posts: 57
Using UIFrameFadeIn/Out to hide UIParent no longer hides the map and quest objectives

Hi,

You guys helped me in the past with this addon:

Code:
local addonName, addonTable = ... ;

local addon = CreateFrame("Frame");

local GetCursorPosition, IsMouselooking = GetCursorPosition, IsMouselooking
local GetMouseFocus = GetMouseFocus
local UIParent, WorldFrame = UIParent, WorldFrame


function addon:FadeIn()
	if not MovieFrame:IsShown() then
		UIFrameFadeIn(UIParent, addonTable.TIMETOFADEIN, UIParent:GetAlpha(), addonTable.FADEIN);
	end
end;

function addon:FadeOut()
	UIFrameFadeOut(UIParent, addonTable.TIMETOFADEOUT, UIParent:GetAlpha(), addonTable.FADEOUT);
end;

function addon:Fadera()
	UIFrameFadeOut(UIParent, 0.1, UIParent:GetAlpha(), 0.01);
end;


addon.timer = 0
local taxi = 0
addon:SetScript("OnEvent", function(self, event, ...)

		if event == "PLAYER_CONTROL_LOST" and not (UnitAffectingCombat("Player") or InCombatLockdown() or IsInInstance()) then
			self.taxi = 1
			addon:Fadera();
		end;
		if event == "PLAYER_CONTROL_GAINED" then
			self.taxi = 0
		end;
		if event == "CINEMATIC_START" then
			self.taxi = 1
			addon:Fadera();
		end;
		if event == "CINEMATIC_STOP" then
			self.taxi = 0
		end;
		if event == "LFG_UPDATE" then
			addon:FadeIn();
			self.timer = 4
		end;
end);

addon:RegisterEvent('PLAYER_CONTROL_LOST')
addon:RegisterEvent('PLAYER_CONTROL_GAINED')
addon:RegisterEvent('CINEMATIC_START')
addon:RegisterEvent('CINEMATIC_STOP')
addon:RegisterEvent('LFG_UPDATE')



addon:SetScript("OnUpdate", function(self, elapsed)
		self.timer = self.timer + elapsed

		local speed = GetUnitSpeed("player");
		local x, y = GetCursorPosition();

		if InCinematic() or (QuestFrame:IsShown() and IsAddOnLoaded("CatchTheWind")) then
			self.timer = addonTable.TIMEAFK
			addon:FadeOut();
		elseif
		((self.taxi ~= 1
		and
		((self.x ~= x and not (not IsResting() and not IsInInstance()))
		or (self.y ~= y and not (not IsResting() and not IsInInstance()))
		or (UnitAffectingCombat("Player")
		or InCombatLockdown()
		or (speed ~=0 and not (not IsResting() and not IsInInstance()))
		or UnitName("mouseover")
		or WorldMapFrame:IsShown()
		or MailFrame:IsShown()
		or (CollectionsJournal and CollectionsJournal:IsShown())
		or GossipFrame:IsShown()
		or GameTooltipTextLeft1:GetText()
		or UnitCastingInfo("Player")
		or UnitChannelInfo("Player")
		or (UnitExists("Target") and not InCinematic())))
		)
		or ChatFrame1EditBox:IsShown()
		)
		and not (QuestFrame:IsShown() and IsAddOnLoaded("CatchTheWind"))
		then
			if not InCinematic() then
				addon:FadeIn();
			end;
		elseif not IsMouselooking() and self.timer > addonTable.TIMEAFK and (GetMouseFocus() == WorldFrame and not MovieFrame:IsShown())
		then
			self.timer = 0
			addon:FadeOut();
		end;
		if self.timer > addonTable.TIMEAFK or InCinematic() then
			if not IsMouselooking() and (GetMouseFocus() == WorldFrame and not MovieFrame:IsShown())

			then
				self.x = x
				self.y = y

			end;

			self.timer = 0
		end;
end)
After one of Legion's patches, it stopped hiding the map and objectives tracker, however. I don't know why. But that's fine.

The issue is, that also happens when the in-game cutscenes (those with the black bars, not the cinematic ones) play and it's kinda annoying to have the quest list + minimap showing up on top of the cutscene.

Is there a way to fix that?
  Reply With Quote