Renamed "GameObject" to "EZGame". I'm not super happy with the name,

so not everything is converted. I'll revisit once I've decided what to do.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@49 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2006-08-23 17:37:26 +00:00
parent c1d05502e4
commit 35f6bc5b90
6 changed files with 31 additions and 29 deletions
+2 -2
View File
@@ -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;
@@ -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
{
/**
+1 -1
View File
@@ -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;
}
}
@@ -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 = [];
@@ -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);
});
});
}
@@ -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 + "].");
});
}