View Single Post
05-11-14, 09:15 PM   #19
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Phanx View Post
The popup is closed in response to other events. There is no timer.
From what I can find seems to be the normal staic popup timer to close the window.

Sources are:
http://wowprogramming.com/utils/xmlb...L/LFGFrame.lua

In this function:
Code:
function LFGInvitePopup_Update(inviter, roleTankAvailable, roleHealerAvailable, roleDamagerAvailable)
there is a line that shows:
Code:
self.timeOut = STATICPOPUP_TIMEOUT;
Then further down in the code it shows:
Code:
function LFGInvitePopup_OnUpdate(self, elapsed)
    self.timeOut = self.timeOut - elapsed;
    if ( self.timeOut <= 0 ) then
        LFGInvitePopupDecline_OnClick();
    end
end
which I'm guessing closes the popup.

Now in this file:http://wowprogramming.com/utils/xmlb...taticPopup.lua

This is at the top of the file:
Code:
STATICPOPUP_TIMEOUT = 60;
So with this information I should set the timeOut to 60 and it should work.

The one thing im not sure of would be the f:SetScript("OnEvent" function(self, event) -- code)
In the Phanx example I got is show a self:Show() and a self.Hide() would that be all that is needed?

Here is my proposed code for the LFG (also while scrolling threw those codes I notice that this was at the top of the code --LFG is used for for generic functions/values that may be used for LFD, LFR, and any other LF_ system we may implement in the future. so it should work on raids as well)
Here is the code:
Code:
	local PROPOSAL_DURATION = 60

	local f = CreateFrame("Frame", nil, LFGDungeonReadyPopup)
	f:SetPoint("TOP", LFGDungeonReadyPopup, "BOTTOM", 0, 15)
	f:SetWidth(LFGDungeonReadyPopup:GetWidth() - 4)
	f:SetHeight(36)
	f:SetBackdrop({ 
		bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], 
		edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border.blp]], 
		edgeSize = 25, insets = { left = 5, right = 5, top = 5, bottom = 5 } 
	})
	f:SetBackdropColor(0, 0, 0, 1)
	
	local text = f:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
	text:SetPoint("CENTER", f, "CENTER", 0, 0)	

	f:SetScript("OnUpdate", function(self)
		local remaining = 0
		local sec = PROPOSAL_DURATION
		if secs and secs > 0 and remaining ~= secs then
			remaining = secs
			local color = secs > 20 and "f20ff20" or secs > 10 and "fffff00" or "fff0000"
			text:SetText("Queue Expires in |cf"..color.. SecondsToTime(secs) .. "|r")
		end
	end)

	f:RegisterEvent("LFG_PROPOSAL_SHOW")
	f:SetScript("OnEvent", function(self, event)
		 if event == "LFG_PROPOSAL_SHOW" then
			  self:Show()
		 else
			  self:Hide()
		 end
	end)
Thanks Everyone
Coke
  Reply With Quote