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:
@@ -34,6 +34,7 @@ import com.threerings.crowd.data.PlaceObject;
|
||||
import com.threerings.crowd.util.CrowdContext;
|
||||
|
||||
import com.threerings.parlor.game.client.GameController;
|
||||
import com.threerings.parlor.game.data.GameConfig;
|
||||
import com.threerings.parlor.game.data.GameObject;
|
||||
|
||||
import com.threerings.parlor.turn.client.TurnGameController;
|
||||
@@ -58,6 +59,13 @@ public class EZGameController extends GameController
|
||||
*/
|
||||
public function userCodeIsConnected (autoReady :Boolean) :void
|
||||
{
|
||||
// if we're not a player, we don't need to report anything to the server
|
||||
var bobj :BodyObject = (_ctx.getClient().getClientObject() as BodyObject);
|
||||
if (_gconfig.getMatchType() != GameConfig.PARTY &&
|
||||
_gobj.getPlayerIndex(bobj.getVisibleName()) != -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (autoReady) {
|
||||
// let the game manager know that we're here and we want to start the game now
|
||||
playerIsReady();
|
||||
@@ -99,6 +107,14 @@ public class EZGameController extends GameController
|
||||
_panel.backend.turnDidChange();
|
||||
}
|
||||
|
||||
// from GameController
|
||||
override protected function shouldAutoPlayerReady (bobj :BodyObject) :Boolean
|
||||
{
|
||||
// we don't want to auto-player ready in willEnterPlace(), we'll do it ourselves after the
|
||||
// client code has connected
|
||||
return false;
|
||||
}
|
||||
|
||||
// from GameController
|
||||
override public function attributeChanged (event :AttributeChangedEvent) :void
|
||||
{
|
||||
@@ -116,22 +132,6 @@ public class EZGameController extends GameController
|
||||
}
|
||||
}
|
||||
|
||||
// from GameController
|
||||
override protected function playerReady () :void
|
||||
{
|
||||
// we require the user to be connected, and we redundantly only do this if the user is in
|
||||
// the players array
|
||||
if (_panel.backend.isConnected()) {
|
||||
var bobj :BodyObject = (_ctx.getClient().getClientObject() as BodyObject);
|
||||
if (_gobj.getPlayerIndex(bobj.getVisibleName()) != -1) {
|
||||
super.playerReady();
|
||||
}
|
||||
|
||||
} else {
|
||||
log.debug("Waiting to call playerReady, userCode not yet connected.");
|
||||
}
|
||||
}
|
||||
|
||||
// from GameController
|
||||
override protected function gameDidStart () :void
|
||||
{
|
||||
|
||||
@@ -540,7 +540,8 @@ public class GameControlBackend
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the client code when it is ready for the game to be started.
|
||||
* Called by the client code when it is ready for the game to be started (if called before the
|
||||
* game ever starts) or rematched (if called after the game has ended).
|
||||
*/
|
||||
protected function playerReady_v1 () :void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user