Slight change to playerReady() handling. For party games all occupants will
call playerReady() rather than none of them. Also tidied up the way EZGameController delays playerReady() until the game backend is connected. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@520 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -95,14 +95,15 @@ public /*abstract*/ class GameController extends PlaceController
|
||||
// and add ourselves as a listener
|
||||
_gobj.addListener(this);
|
||||
|
||||
// we don't want to claim to be finished until any derived classes that overrode this
|
||||
// method have executed, so we'll queue up a runnable here that will let the game manager
|
||||
// know that we're ready on the next pass through the distributed event loop
|
||||
log.info("Entering game " + _gobj.which() + ".");
|
||||
if (_gobj.getPlayerIndex(bobj.getVisibleName()) != -1) {
|
||||
// finally let the game manager know that we're ready to roll
|
||||
// potentially let the game manager know that we're ready to roll
|
||||
if (shouldAutoPlayerReady(bobj)) {
|
||||
// we don't want to claim to be finished until any derived classes that overrode this
|
||||
// method have executed, so we'll queue up a runnable here that will let the game
|
||||
// manager know that we're ready on the next pass through the distributed event loop
|
||||
_ctx.getClient().callLater(playerReady);
|
||||
}
|
||||
|
||||
log.info("Entered game " + _gobj.which() + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,6 +223,14 @@ public /*abstract*/ class GameController extends PlaceController
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if we should automatically call playerReady() in willEnterPlace().
|
||||
*/
|
||||
protected function shouldAutoPlayerReady (bobj :BodyObject) :Boolean
|
||||
{
|
||||
return (_gobj.getPlayerIndex(bobj.getVisibleName()) != -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after we've entered the game and everything has initialized
|
||||
* to notify the server that we, as a player, are ready to play.
|
||||
|
||||
Reference in New Issue
Block a user