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