diff --git a/src/as/com/threerings/ezgame/CardDeck.as b/src/as/com/threerings/ezgame/CardDeck.as index d44e9f3e..b4f29685 100644 --- a/src/as/com/threerings/ezgame/CardDeck.as +++ b/src/as/com/threerings/ezgame/CardDeck.as @@ -6,7 +6,7 @@ package com.threerings.ezgame { */ public class CardDeck { - public function CardDeck (gameObj :GameObject, deckName :String = "deck") + public function CardDeck (gameObj :EZGame, deckName :String = "deck") { _gameObj = gameObj; _deckName = deckName; @@ -35,7 +35,7 @@ public class CardDeck } /** The game object. */ - protected var _gameObj :GameObject; + protected var _gameObj :EZGame; /** The name of our deck. */ protected var _deckName :String; diff --git a/src/as/com/threerings/ezgame/GameObject.as b/src/as/com/threerings/ezgame/EZGame.as similarity index 99% rename from src/as/com/threerings/ezgame/GameObject.as rename to src/as/com/threerings/ezgame/EZGame.as index 5797b9e1..fc6cac08 100644 --- a/src/as/com/threerings/ezgame/GameObject.as +++ b/src/as/com/threerings/ezgame/EZGame.as @@ -5,7 +5,7 @@ import flash.events.IEventDispatcher; /** * The game object that you'll be using to manage your game. */ -public interface GameObject +public interface EZGame extends IEventDispatcher { /** diff --git a/src/as/com/threerings/ezgame/Game.as b/src/as/com/threerings/ezgame/Game.as index 891f3c4d..e16b28fd 100644 --- a/src/as/com/threerings/ezgame/Game.as +++ b/src/as/com/threerings/ezgame/Game.as @@ -11,6 +11,6 @@ public interface Game * Called by the mysterious powers of the cosmos to initialize * your game with the GameObject. */ - function setGameObject (gameObj :GameObject) :void; + function setGameObject (gameObj :EZGame) :void; } } diff --git a/src/as/com/threerings/ezgame/PlayersDisplay.as b/src/as/com/threerings/ezgame/PlayersDisplay.as index f9c88a65..68cf11df 100644 --- a/src/as/com/threerings/ezgame/PlayersDisplay.as +++ b/src/as/com/threerings/ezgame/PlayersDisplay.as @@ -22,7 +22,7 @@ public class PlayersDisplay extends Sprite implements Game { // implementation of Game method - public function setGameObject (gameObj :GameObject) :void + public function setGameObject (gameObj :EZGame) :void { _gameObj = gameObj; _gameObj.addEventListener(StateChangedEvent.TURN_CHANGED, recheckTurn); @@ -112,7 +112,7 @@ public class PlayersDisplay extends Sprite } /** Our game object. */ - protected var _gameObj :GameObject; + protected var _gameObj :EZGame; /** An array of labels, one for each player name. */ protected var _playerLabels :Array = []; diff --git a/src/as/com/threerings/ezgame/client/EZGamePanel.as b/src/as/com/threerings/ezgame/client/EZGamePanel.as index 89cef683..6084a926 100644 --- a/src/as/com/threerings/ezgame/client/EZGamePanel.as +++ b/src/as/com/threerings/ezgame/client/EZGamePanel.as @@ -47,6 +47,8 @@ public class EZGamePanel extends VBox // from PlaceView public function willEnterPlace (plobj :PlaceObject) :void { + var thisPanel :DisplayObject = this; + // don't start notifying anything of the game until we've // notified the game manager that we're in the game // (done in GameController, and it uses callLater, so we do it twice!) @@ -54,7 +56,7 @@ public class EZGamePanel extends VBox _ctx.getClient().callLater(function () :void { _ezObj = (plobj as EZGameObject); - notifyOfGame(this); + notifyOfGame(thisPanel); }); }); } diff --git a/src/as/com/threerings/ezgame/client/GameObjectImpl.as b/src/as/com/threerings/ezgame/client/GameObjectImpl.as index 378ccc85..5e0f67f4 100644 --- a/src/as/com/threerings/ezgame/client/GameObjectImpl.as +++ b/src/as/com/threerings/ezgame/client/GameObjectImpl.as @@ -25,11 +25,11 @@ import com.threerings.ezgame.data.EZGameObject; import com.threerings.ezgame.data.PropertySetEvent; import com.threerings.ezgame.util.EZObjectMarshaller; -import com.threerings.ezgame.GameObject; +import com.threerings.ezgame.EZGame; import com.threerings.ezgame.PropertyChangedEvent; public class GameObjectImpl extends EventDispatcher - implements GameObject + implements EZGame { public function GameObjectImpl (ctx :CrowdContext, ezObj :EZGameObject) { @@ -38,13 +38,13 @@ public class GameObjectImpl extends EventDispatcher _gameData = new GameData(this, _ezObj.getUserProps()); } - // from GameObject + // from EZGame public function get data () :Object { return _gameData; } - // from GameObject + // from EZGame public function get (propName :String, index :int = -1) :Object { var value :Object = data[propName]; @@ -60,7 +60,7 @@ public class GameObjectImpl extends EventDispatcher return value; } - // from GameObject + // from EZGame public function set (propName :String, value :Object, index :int = -1) :void { validatePropertyChange(propName, value, index); @@ -74,19 +74,19 @@ public class GameObjectImpl extends EventDispatcher _ezObj.applyPropertySet(propName, value, index); } - // from GameObject + // from EZGame public function setCollection (collName :String, values :Array) :void { populateCollection(collName, values, true); } - // from GameObject + // from EZGame public function addToCollection (collName :String, values :Array) :void { populateCollection(collName, values, false); } - // from GameObject + // from EZGame public function pickFromCollection ( collName :String, count :int, msgOrPropName :String, playerIndex :int = -1) :void @@ -95,7 +95,7 @@ public class GameObjectImpl extends EventDispatcher false, null); } - // from GameObject + // from EZGame public function dealFromCollection ( collName :String, count :int, msgOrPropName :String, callback :Function = null, playerIndex :int = -1) :void @@ -104,7 +104,7 @@ public class GameObjectImpl extends EventDispatcher true, callback); } - // from GameObject + // from EZGame public function mergeCollection (srcColl :String, intoColl :String) :void { validateName(srcColl); @@ -113,7 +113,7 @@ public class GameObjectImpl extends EventDispatcher srcColl, intoColl, createLoggingListener("mergeCollection")); } - // from GameObject + // from EZGame public function sendMessage ( messageName :String, value :Object, playerIndex :int = -1) :void { @@ -126,7 +126,7 @@ public class GameObjectImpl extends EventDispatcher createLoggingListener("sendMessage")); } - // from GameObject + // from EZGame public function sendChat (msg :String) :void { validateChat(msg); @@ -135,7 +135,7 @@ public class GameObjectImpl extends EventDispatcher _ezObj.postMessage(EZGameObject.GAME_CHAT, [ msg ]); } - // from GameObject + // from EZGame public function localChat (msg :String) :void { validateChat(msg); @@ -145,7 +145,7 @@ public class GameObjectImpl extends EventDispatcher _ctx.getChatDirector().displayInfo(null, MessageBundle.taint(msg)); } - // from GameObject + // from EZGame public function getPlayerNames () :Array { var names :Array = new Array(); @@ -155,19 +155,19 @@ public class GameObjectImpl extends EventDispatcher return names; } - // from GameObject + // from EZGame public function getMyIndex () :int { return _ezObj.getPlayerIndex(getUsername()); } - // from GameObject + // from EZGame public function getTurnHolderIndex () :int { return _ezObj.getPlayerIndex(_ezObj.turnHolder); } - // from GameObject + // from EZGame public function getWinnerIndexes () :Array /* of int */ { var arr :Array = new Array(); @@ -181,26 +181,26 @@ public class GameObjectImpl extends EventDispatcher return arr; } - // from GameObject + // from EZGame public function isMyTurn () :Boolean { return getUsername().equals(_ezObj.turnHolder); } - // from GameObject + // from EZGame public function isInPlay () :Boolean { return _ezObj.isInPlay(); } - // from GameObject + // from EZGame public function endTurn (nextPlayerIndex :int = -1) :void { _ezObj.ezGameService.endTurn(_ctx.getClient(), nextPlayerIndex, createLoggingListener("endTurn")); } - // from GameObject + // from EZGame public function endGame (winnerIndex :int, ... rest) :void { var winners :TypedArray = TypedArray.create(int); @@ -257,7 +257,7 @@ public class GameObjectImpl extends EventDispatcher service :String) :InvocationService_ConfirmListener { return new ConfirmAdapter(function (cause :String) :void { - Log.getLog(GameObject).warning("Service failure " + + Log.getLog(this).warning("Service failure " + "[service=" + service + ", cause=" + cause + "]."); }); }