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:
@@ -63,7 +63,7 @@ public class EZGamePanel extends Canvas
|
|||||||
_ezObj = (plobj as EZGameObject);
|
_ezObj = (plobj as EZGameObject);
|
||||||
backend = createBackend();
|
backend = createBackend();
|
||||||
|
|
||||||
_gameView = new GameContainer(cfg.configData); // TODO?
|
_gameView = new GameContainer(cfg.gameMedia);
|
||||||
_gameView.percentWidth = 100;
|
_gameView.percentWidth = 100;
|
||||||
_gameView.percentHeight = 100;
|
_gameView.percentHeight = 100;
|
||||||
backend.setSharedEvents(
|
backend.setSharedEvents(
|
||||||
|
|||||||
@@ -40,19 +40,19 @@ import com.threerings.ezgame.client.EZGameController;
|
|||||||
public class EZGameConfig extends GameConfig
|
public class EZGameConfig extends GameConfig
|
||||||
implements Hashable
|
implements Hashable
|
||||||
{
|
{
|
||||||
// TODO: this will eventually contain various XML configuration bits,
|
/** The name of the game. */
|
||||||
// or we'll expand this to contain other information.
|
public var name :String;
|
||||||
// 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;
|
|
||||||
|
|
||||||
/** If non-zero, a game id used to persistently identify the game.
|
/** If non-zero, a game id used to persistently identify the game.
|
||||||
* This could be thought of as a new-style rating id. */
|
* This could be thought of as a new-style rating id. */
|
||||||
public var persistentGameId:int;
|
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 ()
|
public function EZGameConfig ()
|
||||||
{
|
{
|
||||||
// nothing needed
|
// nothing needed
|
||||||
@@ -75,7 +75,7 @@ public class EZGameConfig extends GameConfig
|
|||||||
|
|
||||||
override public function getGameName () :String
|
override public function getGameName () :String
|
||||||
{
|
{
|
||||||
return MessageBundle.taint(configData);
|
return MessageBundle.taint(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// from PlaceConfig
|
// from PlaceConfig
|
||||||
@@ -92,7 +92,7 @@ public class EZGameConfig extends GameConfig
|
|||||||
|
|
||||||
override public function hashCode () :int
|
override public function hashCode () :int
|
||||||
{
|
{
|
||||||
return super.hashCode(); // TODO: incorporate configData?
|
return super.hashCode() ^ persistentGameId;
|
||||||
}
|
}
|
||||||
|
|
||||||
override public function equals (other :Object) :Boolean
|
override public function equals (other :Object) :Boolean
|
||||||
@@ -102,7 +102,8 @@ public class EZGameConfig extends GameConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
var that :EZGameConfig = (other as EZGameConfig);
|
var that :EZGameConfig = (other as EZGameConfig);
|
||||||
return (this.configData === that.configData);
|
return (this.persistentGameId == that.persistentGameId) &&
|
||||||
|
(this.gameMedia === that.gameMedia);
|
||||||
}
|
}
|
||||||
|
|
||||||
// from interface Streamable
|
// from interface Streamable
|
||||||
@@ -110,9 +111,10 @@ public class EZGameConfig extends GameConfig
|
|||||||
{
|
{
|
||||||
super.readObject(ins);
|
super.readObject(ins);
|
||||||
|
|
||||||
configData = (ins.readField(String) as String);
|
name = (ins.readField(String) as String)
|
||||||
gameType = ins.readByte();
|
|
||||||
persistentGameId = ins.readInt();
|
persistentGameId = ins.readInt();
|
||||||
|
gameMedia = (ins.readField(String) as String);
|
||||||
|
gameType = ins.readByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
// from interface Streamable
|
// from interface Streamable
|
||||||
@@ -120,9 +122,10 @@ public class EZGameConfig extends GameConfig
|
|||||||
{
|
{
|
||||||
super.writeObject(out);
|
super.writeObject(out);
|
||||||
|
|
||||||
out.writeField(configData);
|
out.writeField(name);
|
||||||
out.writeByte(gameType);
|
|
||||||
out.writeInt(persistentGameId);
|
out.writeInt(persistentGameId);
|
||||||
|
out.writeField(gameMedia);
|
||||||
|
out.writeByte(gameType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ public class EZGamePanel extends JPanel
|
|||||||
|
|
||||||
EZGameConfig cfg = (EZGameConfig) ctrl.getPlaceConfig();
|
EZGameConfig cfg = (EZGameConfig) ctrl.getPlaceConfig();
|
||||||
try {
|
try {
|
||||||
// TODO
|
_gameView = (Component) Class.forName(cfg.gameMedia).newInstance();
|
||||||
_gameView = (Component) Class.forName(cfg.configData).newInstance();
|
|
||||||
add(_gameView);
|
add(_gameView);
|
||||||
} catch (RuntimeException re) {
|
} catch (RuntimeException re) {
|
||||||
throw re;
|
throw re;
|
||||||
|
|||||||
@@ -35,19 +35,20 @@ import com.threerings.ezgame.client.EZGameController;
|
|||||||
*/
|
*/
|
||||||
public class EZGameConfig extends GameConfig
|
public class EZGameConfig extends GameConfig
|
||||||
{
|
{
|
||||||
// TODO: this will eventually contain various XML configuration bits,
|
/** The name of the game. */
|
||||||
// or we'll expand this to contain other information.
|
public String name;
|
||||||
// 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;
|
|
||||||
|
|
||||||
/** If non-zero, a game id used to persistently identify the game.
|
/** If non-zero, a game id used to persistently identify the game.
|
||||||
* This could be thought of as a new-style rating id. */
|
* This could be thought of as a new-style rating id. */
|
||||||
public int persistentGameId;
|
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
|
@Override
|
||||||
public byte getGameType ()
|
public byte getGameType ()
|
||||||
{
|
{
|
||||||
@@ -70,7 +71,7 @@ public class EZGameConfig extends GameConfig
|
|||||||
@Override
|
@Override
|
||||||
public String getGameName ()
|
public String getGameName ()
|
||||||
{
|
{
|
||||||
return MessageBundle.taint(configData);
|
return MessageBundle.taint(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from PlaceConfig
|
@Override // from PlaceConfig
|
||||||
@@ -93,12 +94,13 @@ public class EZGameConfig extends GameConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
EZGameConfig that = (EZGameConfig) other;
|
EZGameConfig that = (EZGameConfig) other;
|
||||||
return this.configData.equals(that.configData);
|
return this.persistentGameId == that.persistentGameId &&
|
||||||
|
this.gameMedia.equals(that.gameMedia);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode ()
|
public int hashCode ()
|
||||||
{
|
{
|
||||||
return super.hashCode(); // TODO: incorp configData?
|
return super.hashCode() ^ persistentGameId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user