For now, the EZGameConfig contains a String called configData that
simply contains the game url or classname. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@51 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -15,6 +15,10 @@ import mx.core.IChildList;
|
|||||||
|
|
||||||
import mx.utils.DisplayUtil;
|
import mx.utils.DisplayUtil;
|
||||||
|
|
||||||
|
import com.threerings.util.MediaContainer;
|
||||||
|
|
||||||
|
import com.threerings.mx.controls.ChatDisplayBox;
|
||||||
|
|
||||||
import com.threerings.crowd.client.PlaceView;
|
import com.threerings.crowd.client.PlaceView;
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
import com.threerings.crowd.util.CrowdContext;
|
import com.threerings.crowd.util.CrowdContext;
|
||||||
@@ -35,20 +39,16 @@ public class EZGamePanel extends VBox
|
|||||||
// add a listener so that we hear about all new children
|
// add a listener so that we hear about all new children
|
||||||
addEventListener(Event.ADDED, childAdded);
|
addEventListener(Event.ADDED, childAdded);
|
||||||
|
|
||||||
// TODO: figure out how we're going to add the client game
|
|
||||||
var cfg :EZGameConfig = (ctrl.getPlaceConfig() as EZGameConfig);
|
var cfg :EZGameConfig = (ctrl.getPlaceConfig() as EZGameConfig);
|
||||||
//_gameView = new MsoySprite(cfg.game);
|
_gameView = new MediaContainer(cfg.configData); // TODO
|
||||||
//addChild(_gameView);
|
addChild(_gameView);
|
||||||
|
|
||||||
// TODO: move chat component into narya?
|
addChild(new ChatDisplayBox(ctx));
|
||||||
//addChild(new ChatTextArea(ctx));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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!)
|
||||||
@@ -56,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(thisPanel);
|
notifyOfGame(_gameView);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -99,6 +99,8 @@ public class EZGamePanel extends VBox
|
|||||||
protected var _ctx :CrowdContext;
|
protected var _ctx :CrowdContext;
|
||||||
protected var _ctrl :EZGameController;
|
protected var _ctrl :EZGameController;
|
||||||
|
|
||||||
|
protected var _gameView :MediaContainer;
|
||||||
|
|
||||||
/** A weak-key hash of the Game interfaces we've already seen. */
|
/** A weak-key hash of the Game interfaces we've already seen. */
|
||||||
protected var _seenGames :Dictionary = new Dictionary(true);
|
protected var _seenGames :Dictionary = new Dictionary(true);
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,10 @@ import com.threerings.ezgame.client.EZGameController;
|
|||||||
public /* abstract */ class EZGameConfig extends GameConfig
|
public /* abstract */ class EZGameConfig extends GameConfig
|
||||||
implements PartyGameConfig
|
implements PartyGameConfig
|
||||||
{
|
{
|
||||||
/** A creator-submitted name of the game. */
|
// TODO: this will eventually contain various XML configuration bits,
|
||||||
public var gameName :String;
|
// or we'll expand this to contain other information.
|
||||||
|
// For now, the configData is either a classname or url.
|
||||||
|
public var configData :String;
|
||||||
|
|
||||||
override public function createController () :PlaceController
|
override public function createController () :PlaceController
|
||||||
{
|
{
|
||||||
@@ -41,7 +43,7 @@ public /* abstract */ class EZGameConfig extends GameConfig
|
|||||||
|
|
||||||
override public function getGameName () :String
|
override public function getGameName () :String
|
||||||
{
|
{
|
||||||
return MessageBundle.taint(gameName);
|
return MessageBundle.taint(configData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// from PartyGameConfig
|
// from PartyGameConfig
|
||||||
@@ -58,26 +60,26 @@ public /* abstract */ class EZGameConfig extends GameConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
var that :EZGameConfig = (other as EZGameConfig);
|
var that :EZGameConfig = (other as EZGameConfig);
|
||||||
return (this.gameName === that.gameName);
|
return (this.configData === that.configData);
|
||||||
}
|
}
|
||||||
|
|
||||||
override public function hashCode () :int
|
override public function hashCode () :int
|
||||||
{
|
{
|
||||||
return super.hashCode(); // TODO: incorporate gamename?
|
return super.hashCode(); // TODO: incorporate configData?
|
||||||
}
|
}
|
||||||
|
|
||||||
override public function writeObject (out :ObjectOutputStream) :void
|
override public function writeObject (out :ObjectOutputStream) :void
|
||||||
{
|
{
|
||||||
super.writeObject(out);
|
super.writeObject(out);
|
||||||
|
|
||||||
out.writeField(gameName);
|
out.writeField(configData);
|
||||||
}
|
}
|
||||||
|
|
||||||
override public function readObject (ins :ObjectInputStream) :void
|
override public function readObject (ins :ObjectInputStream) :void
|
||||||
{
|
{
|
||||||
super.readObject(ins);
|
super.readObject(ins);
|
||||||
|
|
||||||
gameName = (ins.readField(String) as String);
|
configData = (ins.readField(String) as String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ import com.threerings.parlor.game.data.PartyGameConfig;
|
|||||||
public class EZGameConfig extends GameConfig
|
public class EZGameConfig extends GameConfig
|
||||||
implements PartyGameConfig
|
implements PartyGameConfig
|
||||||
{
|
{
|
||||||
/** A creator-submitted name of the game. */
|
// TODO: this will eventually contain various XML configuration bits,
|
||||||
public String gameName;
|
// or we'll expand this to contain other information.
|
||||||
|
// For now, the configData is either a classname or url.
|
||||||
|
public String configData;
|
||||||
|
|
||||||
// from abstract GameConfig
|
// from abstract GameConfig
|
||||||
public String getBundleName ()
|
public String getBundleName ()
|
||||||
@@ -33,7 +35,7 @@ public class EZGameConfig extends GameConfig
|
|||||||
@Override
|
@Override
|
||||||
public String getGameName ()
|
public String getGameName ()
|
||||||
{
|
{
|
||||||
return MessageBundle.taint(gameName);
|
return MessageBundle.taint(configData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// from abstract PlaceConfig
|
// from abstract PlaceConfig
|
||||||
@@ -57,12 +59,12 @@ public class EZGameConfig extends GameConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
EZGameConfig that = (EZGameConfig) other;
|
EZGameConfig that = (EZGameConfig) other;
|
||||||
return this.gameName.equals(that.gameName);
|
return this.configData.equals(that.configData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode ()
|
public int hashCode ()
|
||||||
{
|
{
|
||||||
return super.hashCode(); // TODO: incorp game name?
|
return super.hashCode(); // TODO: incorp configData?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user