View Single Post
03-04-13, 04:19 PM   #23
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
It's only on the "install" part, not the "activate bonus features" part, but the original code only did anything with the UIParent for the "install" part.

@Mayron:
Try making the following substitions:
UIParent:Hide() -> UIParent:SetAlpha(0)
UIParent:Show() -> UIParent:SetAlpha(1)
That may avoid any taint problems, as well as the unwanted re-showing with the Esc key.

It also occurred to me that your dialogs should hide themselves if the player enters combat, and re-show after combat ends. You can add that by changing this part:

Code:
EventFrame:RegisterEvent("PLAYER_LOGIN")
EventFrame:SetScript("OnEvent", function(self, event, ...)
	self:UnregisterAllEvents()
	self:SetScript("OnEvent", nil)

	if MUI_INSTALLED then
		return
	end

	local setupMode = "setup"

	local AceAddon = LibStub("AceAddon-3.0")
	for _, addon in pairs(ADDONS) do
		addon = AceAddon:GetAddon(addon, true) or _G[addon]
		if type(addon) == "table" and type(addon.db) == "table" and type(addon.db.GetCurrentProfile) == "function" and addon.db:GetCurrentProfile() == "MayronUI" then
			setupMode = "bonus"
			break
		end
	end

	if setupMode == "setup" then
		SetupFrame:Show()
elseif setupMode == "bonus" then
		BonusFrame:Show()
	end
end)
to this:
Code:
EventFrame:RegisterEvent("PLAYER_LOGIN")
EventFrame:SetScript("OnEvent", function(self, event, ...)
	if event == "PLAYER_LOGIN" then
		self:UnregisterEvent("PLAYER_LOGIN")

		if MUI_INSTALLED then
			return self:SetScript("OnEvent", nil)
		end

		local setupMode = "setup"

		local AceAddon = LibStub("AceAddon-3.0")
		for _, addon in pairs(ADDONS) do
			addon = AceAddon:GetAddon(addon, true) or _G[addon]
			if type(addon) == "table" and type(addon.db) == "table" and type(addon.db.GetCurrentProfile) == "function" and addon.db:GetCurrentProfile() == "MayronUI" then
				setupMode = "bonus"
				break
			end
		end

		if setupMode == "setup" then
			SetupFrame:Show()
		elseif setupMode == "bonus" then
			BonusFrame:Show()
		end

		self:RegisterEvent("PLAYER_REGEN_DISABLED")
		self:RegisterEvent("PLAYER_REGEN_ENABLED")

	elseif event == "PLAYER_REGEN_DISABLED" then
		if MayronSetupFrame:IsShown() then
			MayronSetupFrame.__wasShown = true
			MayronSetupFrame:Hide()
		end
		if MayronBonusFrame:IsShown() then
			MayronBonusFrame.__wasShown = true
			MayronBonusFrame:Hide()
		end

	else -- PLAYER_REGEN_ENABLED
		if MayronSetupFrame.__wasShown then
			MayronSetupFrame.__wasShown = nil
			MayronSetupFrame:Show()
		end
		if MayronBonusFrame.__wasShown then
			MayronBonusFrame.__wasShown = nil
			MayronBonusFrame:Show()
		end
	end
end)
And add this to both the DoSetup() and DoBonusSetup() functions, right after the <x>Frame:Hide() line:

Code:
	EventFrame:UnregisterAllEvents()
	EventFrame:SetScript("OnEvent", nil)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote