Checkpoint. Closing in on getting a chat client up, but slogging through
annoying streaming issues. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3984 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -447,6 +447,7 @@ public class LocationDirector extends BasicDirector
|
|||||||
// obtain our service handle
|
// obtain our service handle
|
||||||
_lservice =
|
_lservice =
|
||||||
(client.requireService(LocationService) as LocationService);
|
(client.requireService(LocationService) as LocationService);
|
||||||
|
Log.info("location service: " + _lservice);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function gotBodyObject (clobj :BodyObject) :void
|
protected function gotBodyObject (clobj :BodyObject) :void
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
package com.threerings.crowd.data {
|
package com.threerings.crowd.data {
|
||||||
|
|
||||||
|
import com.threerings.util.Integer;
|
||||||
|
|
||||||
import com.threerings.crowd.client.LocationService;
|
import com.threerings.crowd.client.LocationService;
|
||||||
import com.threerings.crowd.client.MoveListener;
|
import com.threerings.crowd.client.MoveListener;
|
||||||
import com.threerings.crowd.data.PlaceConfig;
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
@@ -53,9 +55,10 @@ public class LocationMarshaller extends InvocationMarshaller
|
|||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public function moveTo (arg1 :Client, arg2 :int, arg3 :MoveListener) :void
|
public function moveTo (arg1 :Client, arg2 :int, arg3 :MoveListener) :void
|
||||||
{
|
{
|
||||||
|
com.threerings.crowd.Log.debug("issuing moveTo: " + _invCode);
|
||||||
var listener3 :MoveMarshaller = new MoveMarshaller();
|
var listener3 :MoveMarshaller = new MoveMarshaller();
|
||||||
listener3.listener = arg3;
|
listener3.listener = arg3;
|
||||||
sendRequest(arg1, MOVE_TO, [ arg2, listener3 ]);
|
sendRequest(arg1, MOVE_TO, [ new Integer(arg2), listener3 ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ public class ObjectOutputStream
|
|||||||
// TODO: if _nextCode blows short, log an error
|
// TODO: if _nextCode blows short, log an error
|
||||||
|
|
||||||
writeShort(-cmap.code);
|
writeShort(-cmap.code);
|
||||||
|
Log.debug("wrote classname: " +
|
||||||
|
((streamer == null) ? Translations.getToServer(cname)
|
||||||
|
: streamer.getJavaClassName()));
|
||||||
writeUTF((streamer == null) ? Translations.getToServer(cname)
|
writeUTF((streamer == null) ? Translations.getToServer(cname)
|
||||||
: streamer.getJavaClassName());
|
: streamer.getJavaClassName());
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class ObjectArrayStreamer extends Streamer
|
|||||||
:void
|
:void
|
||||||
{
|
{
|
||||||
var arr :Array = (obj as Array);
|
var arr :Array = (obj as Array);
|
||||||
|
com.threerings.presents.Log.debug("array length: " + arr.length);
|
||||||
out.writeInt(arr.length);
|
out.writeInt(arr.length);
|
||||||
for (var ii :int = 0; ii < arr.length; ii++) {
|
for (var ii :int = 0; ii < arr.length; ii++) {
|
||||||
out.writeObject(arr[ii]);
|
out.writeObject(arr[ii]);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.threerings.msoy.client {
|
package com.threerings.msoy.client {
|
||||||
|
|
||||||
|
import flash.events.Event;
|
||||||
|
|
||||||
import mx.containers.HBox;
|
import mx.containers.HBox;
|
||||||
|
|
||||||
import mx.controls.Button;
|
import mx.controls.Button;
|
||||||
import mx.controls.TextInput;
|
import mx.controls.TextInput;
|
||||||
|
|
||||||
import mx.events.FlexEvent;
|
|
||||||
|
|
||||||
public class ChatControl extends HBox
|
public class ChatControl extends HBox
|
||||||
{
|
{
|
||||||
public function ChatControl (ctx :MsoyContext)
|
public function ChatControl (ctx :MsoyContext)
|
||||||
@@ -18,11 +18,13 @@ public class ChatControl extends HBox
|
|||||||
but.label = "Send"; // TODO: xlate
|
but.label = "Send"; // TODO: xlate
|
||||||
addChild(but);
|
addChild(but);
|
||||||
|
|
||||||
_txt.addEventListener(FlexEvent.ENTER, sendChat);
|
//_txt.addEventListener(FlexEvent.ENTER, sendChat);
|
||||||
but.addEventListener(FlexEvent.BUTTON_DOWN, 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;
|
var message :String = _txt.text;
|
||||||
_txt.text = "";
|
_txt.text = "";
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.threerings.msoy.client {
|
package com.threerings.msoy.client {
|
||||||
|
|
||||||
|
import flash.events.Event;
|
||||||
|
|
||||||
import mx.controls.TextArea;
|
import mx.controls.TextArea;
|
||||||
|
|
||||||
import com.threerings.crowd.chat.client.ChatDirector;
|
import com.threerings.crowd.chat.client.ChatDirector;
|
||||||
import com.threerings.crowd.chat.client.ChatDisplay;
|
import com.threerings.crowd.chat.client.ChatDisplay;
|
||||||
|
import com.threerings.crowd.chat.data.ChatMessage;
|
||||||
|
|
||||||
public class ChatTextArea extends TextArea
|
public class ChatTextArea extends TextArea
|
||||||
implements ChatDisplay
|
implements ChatDisplay
|
||||||
@@ -36,7 +39,7 @@ public class ChatTextArea extends TextArea
|
|||||||
* Check to see if we should register or unregister ourselves as a
|
* Check to see if we should register or unregister ourselves as a
|
||||||
* ChatDisplay.
|
* ChatDisplay.
|
||||||
*/
|
*/
|
||||||
protected void checkVis (event :Event) :void
|
protected function checkVis (event :Event) :void
|
||||||
{
|
{
|
||||||
var chatdir :ChatDirector = _ctx.getChatDirector();
|
var chatdir :ChatDirector = _ctx.getChatDirector();
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
package com.threerings.msoy.client {
|
package com.threerings.msoy.client {
|
||||||
|
|
||||||
import flash.util.describeType;
|
import flash.display.Stage;
|
||||||
|
|
||||||
import mx.collections.ArrayCollection;
|
|
||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
import com.threerings.presents.dobj.DSet;
|
import com.threerings.presents.dobj.DSet;
|
||||||
import com.threerings.presents.data.ClientObject;
|
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.data.LocationMarshaller;
|
||||||
import com.threerings.crowd.chat.data.ChatMarshaller;
|
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 class MsoyClient extends Client
|
||||||
{
|
{
|
||||||
public function MsoyClient ()
|
public function MsoyClient (stage :Stage)
|
||||||
{
|
{
|
||||||
super(new UsernamePasswordCreds(new Name("guest"), "guest"));
|
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);
|
setServer("tasman.sea.earth.threerings.net", DEFAULT_SERVER_PORT);
|
||||||
logon();
|
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
|
public function fuckingCompiler () :void
|
||||||
{
|
{
|
||||||
var i :int = TimeBaseMarshaller.GET_TIME_OID;
|
var i :int = TimeBaseMarshaller.GET_TIME_OID;
|
||||||
i = LocationMarshaller.LEAVE_PLACE;
|
i = LocationMarshaller.LEAVE_PLACE;
|
||||||
i = BodyMarshaller.SET_IDLE;
|
i = BodyMarshaller.SET_IDLE;
|
||||||
i = ChatMarshaller.AWAY;
|
i = ChatMarshaller.AWAY;
|
||||||
|
|
||||||
|
var c :Class = SimpleChatConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected var _ctx :MsoyContext;
|
protected var _ctx :MsoyContext;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.threerings.msoy.client {
|
package com.threerings.msoy.client {
|
||||||
|
|
||||||
|
import flash.display.DisplayObject;
|
||||||
|
import flash.display.Stage;
|
||||||
|
|
||||||
import com.threerings.util.MessageManager;
|
import com.threerings.util.MessageManager;
|
||||||
|
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
@@ -16,9 +19,10 @@ import com.threerings.crowd.chat.client.ChatDirector;
|
|||||||
public class MsoyContext
|
public class MsoyContext
|
||||||
implements CrowdContext
|
implements CrowdContext
|
||||||
{
|
{
|
||||||
public function MsoyContext (client :Client)
|
public function MsoyContext (client :Client, stage :Stage)
|
||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
||||||
|
_stage = stage;
|
||||||
|
|
||||||
// TODO: verify params to these constructors
|
// TODO: verify params to these constructors
|
||||||
_msgmgr = new MessageManager("rsrc");
|
_msgmgr = new MessageManager("rsrc");
|
||||||
@@ -59,17 +63,23 @@ public class MsoyContext
|
|||||||
// documentation inherited from interface CrowdContext
|
// documentation inherited from interface CrowdContext
|
||||||
public function setPlaceView (view :PlaceView) :void
|
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
|
// documentation inherited from interface CrowdContext
|
||||||
public function clearPlaceView (view :PlaceView) :void
|
public function clearPlaceView (view :PlaceView) :void
|
||||||
{
|
{
|
||||||
// TODO
|
_stage.removeChild(view as DisplayObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected var _client :Client;
|
protected var _client :Client;
|
||||||
|
|
||||||
|
protected var _stage :Stage;
|
||||||
|
|
||||||
protected var _msgmgr :MessageManager;
|
protected var _msgmgr :MessageManager;
|
||||||
|
|
||||||
protected var _locdir :LocationDirector;
|
protected var _locdir :LocationDirector;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.threerings.msoy.client {
|
package com.threerings.msoy.client {
|
||||||
|
|
||||||
import com.threerings.crowd.client.CrowdContext;
|
|
||||||
import com.threerings.crowd.client.PlaceController;
|
import com.threerings.crowd.client.PlaceController;
|
||||||
|
import com.threerings.crowd.client.PlaceView;
|
||||||
|
import com.threerings.crowd.util.CrowdContext;
|
||||||
|
|
||||||
public class SimpleChatController extends PlaceController
|
public class SimpleChatController extends PlaceController
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.threerings.msoy.client {
|
|||||||
|
|
||||||
import mx.containers.VBox;
|
import mx.containers.VBox;
|
||||||
|
|
||||||
|
import com.threerings.crowd.client.PlaceView;
|
||||||
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
public class SimpleChatPanel extends VBox
|
public class SimpleChatPanel extends VBox
|
||||||
implements PlaceView
|
implements PlaceView
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ import com.threerings.crowd.data.PlaceConfig;
|
|||||||
|
|
||||||
import com.threerings.msoy.client.SimpleChatController;
|
import com.threerings.msoy.client.SimpleChatController;
|
||||||
|
|
||||||
public class SimpleChatConfig implements PlaceConfig
|
public class SimpleChatConfig extends PlaceConfig
|
||||||
{
|
{
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public override function getControllerClass () :Class
|
public override function getControllerClass () :Class
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ public class Communicator
|
|||||||
Translations.addTranslation(
|
Translations.addTranslation(
|
||||||
"com.threerings.presents.dobj.DSetEntry",
|
"com.threerings.presents.dobj.DSetEntry",
|
||||||
"com.threerings.presents.dobj.DSet$Entry");
|
"com.threerings.presents.dobj.DSet$Entry");
|
||||||
|
Translations.addTranslation(
|
||||||
|
"com.threerings.crowd.data.MoveMarshaller",
|
||||||
|
"com.threerings.crowd.data.LocationMarshaller$MoveMarshaller");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logoff () :void
|
public function logoff () :void
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class InvocationRequestEvent extends DEvent
|
|||||||
super.writeObject(out);
|
super.writeObject(out);
|
||||||
out.writeInt(_invCode);
|
out.writeInt(_invCode);
|
||||||
out.writeByte(_methodId);
|
out.writeByte(_methodId);
|
||||||
out.writeObject(_args);
|
out.writeField(_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface Streamable
|
// documentation inherited from interface Streamable
|
||||||
@@ -118,7 +118,7 @@ public class InvocationRequestEvent extends DEvent
|
|||||||
super.readObject(ins);
|
super.readObject(ins);
|
||||||
_invCode = ins.readInt();
|
_invCode = ins.readInt();
|
||||||
_methodId = ins.readByte();
|
_methodId = ins.readByte();
|
||||||
_args = (ins.readObject() as Array);
|
_args = (ins.readField(Array) as Array);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The code identifying which invocation provider to which this
|
/** The code identifying which invocation provider to which this
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ public class InvocationResponseEvent extends DEvent
|
|||||||
* only values of valid distributed object types.
|
* only values of valid distributed object types.
|
||||||
*/
|
*/
|
||||||
public function InvocationResponseEvent (
|
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);
|
super(targetOid);
|
||||||
_requestId = requestId;
|
_requestId = requestId;
|
||||||
@@ -109,7 +110,7 @@ public class InvocationResponseEvent extends DEvent
|
|||||||
super.writeObject(out);
|
super.writeObject(out);
|
||||||
out.writeShort(_requestId);
|
out.writeShort(_requestId);
|
||||||
out.writeByte(_methodId);
|
out.writeByte(_methodId);
|
||||||
out.writeObject(_args);
|
out.writeField(_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -118,7 +119,7 @@ public class InvocationResponseEvent extends DEvent
|
|||||||
super.readObject(ins);
|
super.readObject(ins);
|
||||||
_requestId = ins.readShort();
|
_requestId = ins.readShort();
|
||||||
_methodId = ins.readByte();
|
_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. */
|
/** The id of the request with which this response is associated. */
|
||||||
|
|||||||
Reference in New Issue
Block a user