diff --git a/src/as/com/threerings/crowd/client/LocationDirector.as b/src/as/com/threerings/crowd/client/LocationDirector.as index 09e08defe..b8ee7ea48 100644 --- a/src/as/com/threerings/crowd/client/LocationDirector.as +++ b/src/as/com/threerings/crowd/client/LocationDirector.as @@ -447,6 +447,7 @@ public class LocationDirector extends BasicDirector // obtain our service handle _lservice = (client.requireService(LocationService) as LocationService); + Log.info("location service: " + _lservice); } protected function gotBodyObject (clobj :BodyObject) :void diff --git a/src/as/com/threerings/crowd/data/LocationMarshaller.as b/src/as/com/threerings/crowd/data/LocationMarshaller.as index efeab9cd5..19a57bddc 100644 --- a/src/as/com/threerings/crowd/data/LocationMarshaller.as +++ b/src/as/com/threerings/crowd/data/LocationMarshaller.as @@ -21,6 +21,8 @@ package com.threerings.crowd.data { +import com.threerings.util.Integer; + import com.threerings.crowd.client.LocationService; import com.threerings.crowd.client.MoveListener; import com.threerings.crowd.data.PlaceConfig; @@ -53,9 +55,10 @@ public class LocationMarshaller extends InvocationMarshaller // documentation inherited from interface public function moveTo (arg1 :Client, arg2 :int, arg3 :MoveListener) :void { + com.threerings.crowd.Log.debug("issuing moveTo: " + _invCode); var listener3 :MoveMarshaller = new MoveMarshaller(); listener3.listener = arg3; - sendRequest(arg1, MOVE_TO, [ arg2, listener3 ]); + sendRequest(arg1, MOVE_TO, [ new Integer(arg2), listener3 ]); } } } diff --git a/src/as/com/threerings/io/ObjectOutputStream.as b/src/as/com/threerings/io/ObjectOutputStream.as index 3eb63cec3..5353d57e1 100644 --- a/src/as/com/threerings/io/ObjectOutputStream.as +++ b/src/as/com/threerings/io/ObjectOutputStream.as @@ -50,6 +50,9 @@ public class ObjectOutputStream // TODO: if _nextCode blows short, log an error writeShort(-cmap.code); + Log.debug("wrote classname: " + + ((streamer == null) ? Translations.getToServer(cname) + : streamer.getJavaClassName())); writeUTF((streamer == null) ? Translations.getToServer(cname) : streamer.getJavaClassName()); diff --git a/src/as/com/threerings/io/streamers/ObjectArrayStreamer.as b/src/as/com/threerings/io/streamers/ObjectArrayStreamer.as index 153df8d54..642655184 100644 --- a/src/as/com/threerings/io/streamers/ObjectArrayStreamer.as +++ b/src/as/com/threerings/io/streamers/ObjectArrayStreamer.as @@ -30,6 +30,7 @@ public class ObjectArrayStreamer extends Streamer :void { var arr :Array = (obj as Array); + com.threerings.presents.Log.debug("array length: " + arr.length); out.writeInt(arr.length); for (var ii :int = 0; ii < arr.length; ii++) { out.writeObject(arr[ii]); diff --git a/src/as/com/threerings/msoy/client/ChatControl.as b/src/as/com/threerings/msoy/client/ChatControl.as index ab123d205..d05e762a4 100644 --- a/src/as/com/threerings/msoy/client/ChatControl.as +++ b/src/as/com/threerings/msoy/client/ChatControl.as @@ -1,12 +1,12 @@ package com.threerings.msoy.client { +import flash.events.Event; + import mx.containers.HBox; import mx.controls.Button; import mx.controls.TextInput; -import mx.events.FlexEvent; - public class ChatControl extends HBox { public function ChatControl (ctx :MsoyContext) @@ -18,11 +18,13 @@ public class ChatControl extends HBox but.label = "Send"; // TODO: xlate addChild(but); - _txt.addEventListener(FlexEvent.ENTER, sendChat); - but.addEventListener(FlexEvent.BUTTON_DOWN, sendChat); + //_txt.addEventListener(FlexEvent.ENTER, sendChat); + //but.addEventListener(FlexEvent.BUTTON_DOWN, sendChat); + _txt.addEventListener("enter", sendChat); + but.addEventListener("buttonDown", sendChat); } - protected function sendChat (event :FlexEvent) :void + protected function sendChat (event :Event) :void { var message :String = _txt.text; _txt.text = ""; diff --git a/src/as/com/threerings/msoy/client/ChatTextArea.as b/src/as/com/threerings/msoy/client/ChatTextArea.as index 83968f1d6..4f76abf71 100644 --- a/src/as/com/threerings/msoy/client/ChatTextArea.as +++ b/src/as/com/threerings/msoy/client/ChatTextArea.as @@ -1,9 +1,12 @@ package com.threerings.msoy.client { +import flash.events.Event; + import mx.controls.TextArea; import com.threerings.crowd.chat.client.ChatDirector; import com.threerings.crowd.chat.client.ChatDisplay; +import com.threerings.crowd.chat.data.ChatMessage; public class ChatTextArea extends TextArea implements ChatDisplay @@ -36,7 +39,7 @@ public class ChatTextArea extends TextArea * Check to see if we should register or unregister ourselves as a * ChatDisplay. */ - protected void checkVis (event :Event) :void + protected function checkVis (event :Event) :void { var chatdir :ChatDirector = _ctx.getChatDirector(); if (this.visible) { diff --git a/src/as/com/threerings/msoy/client/MsoyClient.as b/src/as/com/threerings/msoy/client/MsoyClient.as index 1ac32685b..f44e3ba9b 100644 --- a/src/as/com/threerings/msoy/client/MsoyClient.as +++ b/src/as/com/threerings/msoy/client/MsoyClient.as @@ -1,11 +1,8 @@ package com.threerings.msoy.client { -import flash.util.describeType; - -import mx.collections.ArrayCollection; +import flash.display.Stage; import com.threerings.util.Name; -import com.threerings.presents.Log; import com.threerings.presents.client.Client; import com.threerings.presents.dobj.DSet; import com.threerings.presents.data.ClientObject; @@ -21,25 +18,50 @@ import com.threerings.crowd.data.BodyMarshaller; import com.threerings.crowd.data.LocationMarshaller; import com.threerings.crowd.chat.data.ChatMarshaller; +import com.threerings.msoy.Log; +import com.threerings.msoy.data.MsoyBootstrapData; +import com.threerings.msoy.data.SimpleChatConfig; public class MsoyClient extends Client { - public function MsoyClient () + public function MsoyClient (stage :Stage) { super(new UsernamePasswordCreds(new Name("guest"), "guest")); - _ctx = new MsoyContext(this); + _ctx = new MsoyContext(this, stage); setServer("tasman.sea.earth.threerings.net", DEFAULT_SERVER_PORT); logon(); } +// // documetnation inherited +// public override function gotBootstrap ( +// data :BootstrapData, omgr :DObjectManager) :void +// { +// super.gotBootstrap(data, omgr); +// +// // let's kick things off by going directly to our global chat room +// // TEMP +// _ctx.getLocationDirector().moveTo((data as MsoyBootstrapData).chatOid); +// } + + // documetnation inherited + public override function gotClientObject (clobj :ClientObject) :void + { + super.gotClientObject(clobj); + + _ctx.getLocationDirector().moveTo( + (getBootstrapData() as MsoyBootstrapData).chatOid); + } + public function fuckingCompiler () :void { var i :int = TimeBaseMarshaller.GET_TIME_OID; i = LocationMarshaller.LEAVE_PLACE; i = BodyMarshaller.SET_IDLE; i = ChatMarshaller.AWAY; + + var c :Class = SimpleChatConfig; } protected var _ctx :MsoyContext; diff --git a/src/as/com/threerings/msoy/client/MsoyContext.as b/src/as/com/threerings/msoy/client/MsoyContext.as index b69f37e89..4c95c50cb 100644 --- a/src/as/com/threerings/msoy/client/MsoyContext.as +++ b/src/as/com/threerings/msoy/client/MsoyContext.as @@ -1,5 +1,8 @@ package com.threerings.msoy.client { +import flash.display.DisplayObject; +import flash.display.Stage; + import com.threerings.util.MessageManager; import com.threerings.presents.client.Client; @@ -16,9 +19,10 @@ import com.threerings.crowd.chat.client.ChatDirector; public class MsoyContext implements CrowdContext { - public function MsoyContext (client :Client) + public function MsoyContext (client :Client, stage :Stage) { _client = client; + _stage = stage; // TODO: verify params to these constructors _msgmgr = new MessageManager("rsrc"); @@ -59,17 +63,23 @@ public class MsoyContext // documentation inherited from interface CrowdContext public function setPlaceView (view :PlaceView) :void { - // TODO + for (var ii :int = _stage.numChildren - 1; ii >= 0; ii--) { + _stage.removeChildAt(ii); + } + + _stage.addChild(view as DisplayObject); } // documentation inherited from interface CrowdContext public function clearPlaceView (view :PlaceView) :void { - // TODO + _stage.removeChild(view as DisplayObject); } protected var _client :Client; + protected var _stage :Stage; + protected var _msgmgr :MessageManager; protected var _locdir :LocationDirector; diff --git a/src/as/com/threerings/msoy/client/SimpleChatController.as b/src/as/com/threerings/msoy/client/SimpleChatController.as index 144481c77..bb0fa0e76 100644 --- a/src/as/com/threerings/msoy/client/SimpleChatController.as +++ b/src/as/com/threerings/msoy/client/SimpleChatController.as @@ -1,7 +1,8 @@ package com.threerings.msoy.client { -import com.threerings.crowd.client.CrowdContext; import com.threerings.crowd.client.PlaceController; +import com.threerings.crowd.client.PlaceView; +import com.threerings.crowd.util.CrowdContext; public class SimpleChatController extends PlaceController { diff --git a/src/as/com/threerings/msoy/client/SimpleChatPanel.as b/src/as/com/threerings/msoy/client/SimpleChatPanel.as index 307c36c2d..bdc1ed9a9 100644 --- a/src/as/com/threerings/msoy/client/SimpleChatPanel.as +++ b/src/as/com/threerings/msoy/client/SimpleChatPanel.as @@ -2,6 +2,9 @@ package com.threerings.msoy.client { import mx.containers.VBox; +import com.threerings.crowd.client.PlaceView; +import com.threerings.crowd.data.PlaceObject; + public class SimpleChatPanel extends VBox implements PlaceView { diff --git a/src/as/com/threerings/msoy/data/MsoyBootstrapData.as b/src/as/com/threerings/msoy/data/MsoyBootstrapData.as new file mode 100644 index 000000000..5bb4fd5f1 --- /dev/null +++ b/src/as/com/threerings/msoy/data/MsoyBootstrapData.as @@ -0,0 +1,21 @@ +package com.threerings.msoy.data { + +import com.threerings.presents.net.BootstrapData; + +import com.threerings.io.ObjectInputStream; +import com.threerings.io.ObjectOutputStream; + +public class MsoyBootstrapData extends BootstrapData +{ + /** The oid of the chat room we should join. */ + public var chatOid :int; + + // documentation inherited + public override function readObject (ins :ObjectInputStream) :void + { + super.readObject(ins); + + chatOid = ins.readInt(); + } +} +} diff --git a/src/as/com/threerings/msoy/data/SimpleChatConfig.as b/src/as/com/threerings/msoy/data/SimpleChatConfig.as index 11af4cc6e..a5e83dcdb 100644 --- a/src/as/com/threerings/msoy/data/SimpleChatConfig.as +++ b/src/as/com/threerings/msoy/data/SimpleChatConfig.as @@ -4,7 +4,7 @@ import com.threerings.crowd.data.PlaceConfig; import com.threerings.msoy.client.SimpleChatController; -public class SimpleChatConfig implements PlaceConfig +public class SimpleChatConfig extends PlaceConfig { // documentation inherited public override function getControllerClass () :Class diff --git a/src/as/com/threerings/presents/client/Communicator.as b/src/as/com/threerings/presents/client/Communicator.as index bd7a74faa..3f82afbb3 100644 --- a/src/as/com/threerings/presents/client/Communicator.as +++ b/src/as/com/threerings/presents/client/Communicator.as @@ -61,6 +61,9 @@ public class Communicator Translations.addTranslation( "com.threerings.presents.dobj.DSetEntry", "com.threerings.presents.dobj.DSet$Entry"); + Translations.addTranslation( + "com.threerings.crowd.data.MoveMarshaller", + "com.threerings.crowd.data.LocationMarshaller$MoveMarshaller"); } public function logoff () :void diff --git a/src/as/com/threerings/presents/dobj/InvocationRequestEvent.as b/src/as/com/threerings/presents/dobj/InvocationRequestEvent.as index 27949c49e..9c9eaa6ff 100644 --- a/src/as/com/threerings/presents/dobj/InvocationRequestEvent.as +++ b/src/as/com/threerings/presents/dobj/InvocationRequestEvent.as @@ -109,7 +109,7 @@ public class InvocationRequestEvent extends DEvent super.writeObject(out); out.writeInt(_invCode); out.writeByte(_methodId); - out.writeObject(_args); + out.writeField(_args); } // documentation inherited from interface Streamable @@ -118,7 +118,7 @@ public class InvocationRequestEvent extends DEvent super.readObject(ins); _invCode = ins.readInt(); _methodId = ins.readByte(); - _args = (ins.readObject() as Array); + _args = (ins.readField(Array) as Array); } /** The code identifying which invocation provider to which this diff --git a/src/as/com/threerings/presents/dobj/InvocationResponseEvent.as b/src/as/com/threerings/presents/dobj/InvocationResponseEvent.as index 274e9784c..869204da7 100644 --- a/src/as/com/threerings/presents/dobj/InvocationResponseEvent.as +++ b/src/as/com/threerings/presents/dobj/InvocationResponseEvent.as @@ -45,7 +45,8 @@ public class InvocationResponseEvent extends DEvent * only values of valid distributed object types. */ public function InvocationResponseEvent ( - targetOid :int, requestId :int, methodId :int, args :Array) + targetOid :int = 0, requestId :int = 0, methodId :int = 0, + args :Array = null) { super(targetOid); _requestId = requestId; @@ -109,7 +110,7 @@ public class InvocationResponseEvent extends DEvent super.writeObject(out); out.writeShort(_requestId); out.writeByte(_methodId); - out.writeObject(_args); + out.writeField(_args); } // documentation inherited @@ -118,7 +119,7 @@ public class InvocationResponseEvent extends DEvent super.readObject(ins); _requestId = ins.readShort(); _methodId = ins.readByte(); - _args = (ins.readObject() as Array); + _args = (ins.readField(Array) as Array); } /** The id of the request with which this response is associated. */