mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 09:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,115 @@
|
||||
package waitingRoomFlow
|
||||
{
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import com.sbi.loader.ResourceStack;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.StageQuality;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLLoaderDataFormat;
|
||||
import flash.net.URLRequest;
|
||||
import flash.system.Security;
|
||||
import flash.utils.Timer;
|
||||
|
||||
public class WaitingRoom extends MovieClip
|
||||
{
|
||||
|
||||
public var mainLayer:DisplayLayer;
|
||||
|
||||
public var loadLayer:DisplayLayer;
|
||||
|
||||
private var _waitingRoomFlashVars:Object;
|
||||
|
||||
private var _resourceStack:ResourceStack;
|
||||
|
||||
private var _pollTimer:Timer;
|
||||
|
||||
private var _username:String;
|
||||
|
||||
private var _waitingRoom:MovieClip;
|
||||
|
||||
public function WaitingRoom(initFlashVars:Object)
|
||||
{
|
||||
super();
|
||||
this._waitingRoomFlashVars = initFlashVars;
|
||||
}
|
||||
|
||||
public function waitCtorHelper() : void
|
||||
{
|
||||
this.init();
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
Security.allowDomain("*");
|
||||
this._username = this._waitingRoomFlashVars.username;
|
||||
this.mainLayer = new DisplayLayer();
|
||||
addChild(this.mainLayer);
|
||||
this._resourceStack = new ResourceStack(gMainFrame.path,gMainFrame.loaderCache.openFile);
|
||||
this._resourceStack.pushClass(new ConnectToWaitingRoomServerResourceStackable(this._username),false);
|
||||
this._resourceStack.pushClass(new LoadWaitingRoomMediaResourceStackable(this.setWaitingRoomMovieClip),false);
|
||||
this._resourceStack.start(this.waitingRoomSetupDone);
|
||||
this.loadLayer = new DisplayLayer();
|
||||
addChild(this.loadLayer);
|
||||
LoadProgress.init(this.loadLayer);
|
||||
gMainFrame.stage.quality = StageQuality.MEDIUM;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
this._pollTimer.reset();
|
||||
this._pollTimer = null;
|
||||
}
|
||||
|
||||
public function setWaitingRoomMovieClip(loadedClip:MovieClip) : void
|
||||
{
|
||||
this._waitingRoom = loadedClip;
|
||||
this.mainLayer.addChild(this._waitingRoom);
|
||||
}
|
||||
|
||||
private function waitingRoomSetupDone() : void
|
||||
{
|
||||
DebugUtility.debugTrace("waitingRoom setup done - starting poll timer");
|
||||
this._pollTimer = new Timer(5000);
|
||||
this._pollTimer.addEventListener(TimerEvent.TIMER,this.handleWaitingRoomPollTimer);
|
||||
this._pollTimer.start();
|
||||
LoadProgress.show(false);
|
||||
}
|
||||
|
||||
private function handleWaitingRoomPollTimer(t:TimerEvent) : void
|
||||
{
|
||||
var r:URLLoader = null;
|
||||
try
|
||||
{
|
||||
r = new URLLoader();
|
||||
r.dataFormat = URLLoaderDataFormat.TEXT;
|
||||
r.addEventListener(Event.COMPLETE,this.pollCompleteHandler,false,0,true);
|
||||
DebugUtility.debugTrace("ConnectToWaitingRoomServerResourceStackable init() - connect url:http://" + gMainFrame.clientInfo.waitingRoomServerAddress + ":" + gMainFrame.clientInfo.waitingRoomServerPort + "/poll username:" + this._username);
|
||||
r.load(new URLRequest("http://" + gMainFrame.clientInfo.waitingRoomServerAddress + ":" + gMainFrame.clientInfo.waitingRoomServerPort + "/poll"));
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
DebugUtility.debugTrace("error polling waitingRoom server:" + e.getStackTrace());
|
||||
LoadProgress.show(true,"Error polling for full server - please try again later");
|
||||
_pollTimer.reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private function pollCompleteHandler(e:Event) : void
|
||||
{
|
||||
var statusString:String = e.target.data;
|
||||
if(statusString == "")
|
||||
{
|
||||
LoadProgress.show(true,"Error with poll of waiting room server - please try again later");
|
||||
return;
|
||||
}
|
||||
if(statusString == "enter")
|
||||
{
|
||||
LoadProgress.show(true,"Ready- please refresh to log in now!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user