From 66a7d642dfcab12bafaaee23226a4411ee1e5099 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 6 Mar 2007 19:26:42 +0000 Subject: [PATCH] The temporaray 'configData' is now renamed to 'gameMedia'. Brought in 'name' from MsoyGameConfig, because it's useful. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@230 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../threerings/ezgame/client/EZGamePanel.as | 2 +- .../threerings/ezgame/data/EZGameConfig.as | 33 ++++++++++--------- .../threerings/ezgame/client/EZGamePanel.java | 3 +- .../threerings/ezgame/data/EZGameConfig.java | 24 +++++++------- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/as/com/threerings/ezgame/client/EZGamePanel.as b/src/as/com/threerings/ezgame/client/EZGamePanel.as index 461b76e7..801d9f69 100644 --- a/src/as/com/threerings/ezgame/client/EZGamePanel.as +++ b/src/as/com/threerings/ezgame/client/EZGamePanel.as @@ -63,7 +63,7 @@ public class EZGamePanel extends Canvas _ezObj = (plobj as EZGameObject); backend = createBackend(); - _gameView = new GameContainer(cfg.configData); // TODO? + _gameView = new GameContainer(cfg.gameMedia); _gameView.percentWidth = 100; _gameView.percentHeight = 100; backend.setSharedEvents( diff --git a/src/as/com/threerings/ezgame/data/EZGameConfig.as b/src/as/com/threerings/ezgame/data/EZGameConfig.as index 810ee6a4..6274f3fd 100644 --- a/src/as/com/threerings/ezgame/data/EZGameConfig.as +++ b/src/as/com/threerings/ezgame/data/EZGameConfig.as @@ -40,19 +40,19 @@ import com.threerings.ezgame.client.EZGameController; public class EZGameConfig extends GameConfig implements Hashable { - // TODO: this will eventually contain various XML configuration bits, - // or we'll expand this to contain other information. - // For now, the configData is either a classname or url. - public var configData :String; - - // TODO: this is separate right now, but may eventually be extracted - // from configData? Do not read this value, use getGameType() - public var gameType :int = SEATED_GAME; + /** The name of the game. */ + public var name :String; /** If non-zero, a game id used to persistently identify the game. * This could be thought of as a new-style rating id. */ public var persistentGameId:int; + /** The media for the game. In flash, this is the URL to the SWF file. */ + public var gameMedia :String; + + /** The game type. */ + public var gameType :int = SEATED_GAME; + public function EZGameConfig () { // nothing needed @@ -75,7 +75,7 @@ public class EZGameConfig extends GameConfig override public function getGameName () :String { - return MessageBundle.taint(configData); + return MessageBundle.taint(name); } // from PlaceConfig @@ -92,7 +92,7 @@ public class EZGameConfig extends GameConfig override public function hashCode () :int { - return super.hashCode(); // TODO: incorporate configData? + return super.hashCode() ^ persistentGameId; } override public function equals (other :Object) :Boolean @@ -102,7 +102,8 @@ public class EZGameConfig extends GameConfig } var that :EZGameConfig = (other as EZGameConfig); - return (this.configData === that.configData); + return (this.persistentGameId == that.persistentGameId) && + (this.gameMedia === that.gameMedia); } // from interface Streamable @@ -110,9 +111,10 @@ public class EZGameConfig extends GameConfig { super.readObject(ins); - configData = (ins.readField(String) as String); - gameType = ins.readByte(); + name = (ins.readField(String) as String) persistentGameId = ins.readInt(); + gameMedia = (ins.readField(String) as String); + gameType = ins.readByte(); } // from interface Streamable @@ -120,9 +122,10 @@ public class EZGameConfig extends GameConfig { super.writeObject(out); - out.writeField(configData); - out.writeByte(gameType); + out.writeField(name); out.writeInt(persistentGameId); + out.writeField(gameMedia); + out.writeByte(gameType); } } } diff --git a/src/java/com/threerings/ezgame/client/EZGamePanel.java b/src/java/com/threerings/ezgame/client/EZGamePanel.java index 452b3474..4644faef 100644 --- a/src/java/com/threerings/ezgame/client/EZGamePanel.java +++ b/src/java/com/threerings/ezgame/client/EZGamePanel.java @@ -58,8 +58,7 @@ public class EZGamePanel extends JPanel EZGameConfig cfg = (EZGameConfig) ctrl.getPlaceConfig(); try { - // TODO - _gameView = (Component) Class.forName(cfg.configData).newInstance(); + _gameView = (Component) Class.forName(cfg.gameMedia).newInstance(); add(_gameView); } catch (RuntimeException re) { throw re; diff --git a/src/java/com/threerings/ezgame/data/EZGameConfig.java b/src/java/com/threerings/ezgame/data/EZGameConfig.java index 2d9fcf8f..0999fe19 100644 --- a/src/java/com/threerings/ezgame/data/EZGameConfig.java +++ b/src/java/com/threerings/ezgame/data/EZGameConfig.java @@ -35,19 +35,20 @@ import com.threerings.ezgame.client.EZGameController; */ public class EZGameConfig extends GameConfig { - // TODO: this will eventually contain various XML configuration bits, - // or we'll expand this to contain other information. - // For now, the configData is either a classname or url. - public String configData; - - // TODO: this is separate right now, but may eventually be extracted - // from configData? Do not read this value, use getGameType() - public byte gameType = SEATED_GAME; + /** The name of the game. */ + public String name; /** If non-zero, a game id used to persistently identify the game. * This could be thought of as a new-style rating id. */ public int persistentGameId; + /** The media for the game. In flash this is the URL to the SWF file. + * In Java, this will be a class name, or maybe a Jar. TODO? */ + public String gameMedia; + + /** The game type. */ + public byte gameType = SEATED_GAME; + @Override public byte getGameType () { @@ -70,7 +71,7 @@ public class EZGameConfig extends GameConfig @Override public String getGameName () { - return MessageBundle.taint(configData); + return MessageBundle.taint(name); } @Override // from PlaceConfig @@ -93,12 +94,13 @@ public class EZGameConfig extends GameConfig } EZGameConfig that = (EZGameConfig) other; - return this.configData.equals(that.configData); + return this.persistentGameId == that.persistentGameId && + this.gameMedia.equals(that.gameMedia); } @Override public int hashCode () { - return super.hashCode(); // TODO: incorp configData? + return super.hashCode() ^ persistentGameId; } }