Wait until the usercode has connected to the GameControlBackend prior

to sending a playerReady notification to the server.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@212 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2007-02-26 19:20:15 +00:00
parent 6808911f65
commit 44ad4f517d
3 changed files with 43 additions and 2 deletions
@@ -89,10 +89,11 @@ public class GameControlBackend
public var log :Log = Log.getLog(this);
public function GameControlBackend (
ctx :CrowdContext, ezObj :EZGameObject)
ctx :CrowdContext, ezObj :EZGameObject, ctrl :EZGameController)
{
_ctx = ctx;
_ezObj = ezObj;
_ctrl = ctrl;
_gameData = new GameData(setProperty_v1, _ezObj.getUserProps());
_ezObj.addListener(this);
@@ -104,6 +105,14 @@ public class GameControlBackend
disp.addEventListener("ezgameQuery", handleEZQuery);
}
/**
* Are we connected to the usercode on the front-end?
*/
public function isConnected () :Boolean
{
return (_userFuncs != null);
}
public function setContainer (container :GameContainer) :void
{
_container = container;
@@ -120,6 +129,9 @@ public class GameControlBackend
setUserCodeProperties(evt.userProps);
evt.ezProps = new Object();
populateProperties(evt.ezProps);
// ok, we're now hooked-up with the game code
_ctrl.userCodeIsConnected();
}
protected function setUserCodeProperties (o :Object) :void
@@ -813,6 +825,9 @@ public class GameControlBackend
protected var _ezObj :EZGameObject;
/** Handles trusted clientside control. */
protected var _ctrl :EZGameController;
protected var _userFuncs :Object;
/** The function on the EZGameControl which we can use to directly