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
This commit is contained in:
Ray Greenwell
2007-03-06 19:26:42 +00:00
parent 69bed52e99
commit 66a7d642df
4 changed files with 33 additions and 29 deletions
@@ -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(
@@ -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);
}
}
}
@@ -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;
@@ -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;
}
}