Moved to msoy repository.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4002 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
package com.threerings.msoy.client {
|
||||
|
||||
import flash.events.Event;
|
||||
|
||||
import mx.containers.HBox;
|
||||
|
||||
import mx.controls.Button;
|
||||
import mx.controls.TextInput;
|
||||
|
||||
public class ChatControl extends HBox
|
||||
{
|
||||
public function ChatControl (ctx :MsoyContext)
|
||||
{
|
||||
_ctx = ctx;
|
||||
|
||||
addChild(_txt = new TextInput());
|
||||
var but :Button = new Button();
|
||||
but.label = "Send"; // TODO: xlate
|
||||
addChild(but);
|
||||
|
||||
//_txt.addEventListener(FlexEvent.ENTER, sendChat);
|
||||
//but.addEventListener(FlexEvent.BUTTON_DOWN, sendChat);
|
||||
_txt.addEventListener("enter", sendChat);
|
||||
but.addEventListener("buttonDown", sendChat);
|
||||
}
|
||||
|
||||
protected function sendChat (event :Event) :void
|
||||
{
|
||||
var message :String = _txt.text;
|
||||
_txt.text = "";
|
||||
_ctx.getChatDirector().requestChat(null, message, true);
|
||||
}
|
||||
|
||||
/** Our client-side context. */
|
||||
protected var _ctx :MsoyContext;
|
||||
|
||||
protected var _txt :TextInput;
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
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
|
||||
{
|
||||
public function ChatTextArea (ctx :MsoyContext)
|
||||
{
|
||||
_ctx = ctx;
|
||||
this.editable = false;
|
||||
|
||||
// set up some events to manage how we'll be shown, etc.
|
||||
addEventListener("creationComplete", checkVis);
|
||||
addEventListener("show", checkVis);
|
||||
addEventListener("hide", checkVis);
|
||||
}
|
||||
|
||||
// documentation inherited from interface ChatDisplay
|
||||
public function clear () :void
|
||||
{
|
||||
this.htmlText = "";
|
||||
}
|
||||
|
||||
// documentation inherited from interface ChatDisplay
|
||||
public function displayMessage (msg :ChatMessage) :void
|
||||
{
|
||||
this.htmlText += "<font color=\"red\"><TODO></font> " +
|
||||
msg.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if we should register or unregister ourselves as a
|
||||
* ChatDisplay.
|
||||
*/
|
||||
protected function checkVis (event :Event) :void
|
||||
{
|
||||
var chatdir :ChatDirector = _ctx.getChatDirector();
|
||||
if (this.visible) {
|
||||
chatdir.addChatDisplay(this);
|
||||
} else {
|
||||
chatdir.removeChatDisplay(this);
|
||||
}
|
||||
}
|
||||
|
||||
/** The giver of life. */
|
||||
protected var _ctx :MsoyContext;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.threerings.msoy.client {
|
||||
|
||||
import mx.core.Application;
|
||||
import mx.events.FlexEvent;
|
||||
|
||||
public class MsoyApp extends Application
|
||||
{
|
||||
public function MsoyApp ()
|
||||
{
|
||||
super();
|
||||
addEventListener(attachApplication, nowShowing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called once we're ready to go.
|
||||
*/
|
||||
private function nowShowing (event :FlexEvent) :void
|
||||
{
|
||||
removeEventListener(attachApplication, nowShowing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.threerings.msoy.client {
|
||||
|
||||
import flash.display.Stage;
|
||||
|
||||
import mx.core.Application;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.net.UsernamePasswordCreds;
|
||||
|
||||
import com.threerings.presents.dobj.DObjectManager;
|
||||
|
||||
import com.threerings.presents.net.BootstrapData;
|
||||
|
||||
// imported so that they'll be compiled into the .swf
|
||||
import com.threerings.presents.data.TimeBaseMarshaller;
|
||||
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 (app :Application)
|
||||
{
|
||||
super(new UsernamePasswordCreds(new Name("guest"), "guest"));
|
||||
|
||||
_ctx = new MsoyContext(this, app);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.threerings.msoy.client {
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Stage;
|
||||
|
||||
import mx.core.Application;
|
||||
|
||||
import com.threerings.util.MessageManager;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.dobj.DObjectManager;
|
||||
|
||||
import com.threerings.crowd.client.ChatDirector;
|
||||
import com.threerings.crowd.client.LocationDirector;
|
||||
import com.threerings.crowd.client.OccupantDirector;
|
||||
import com.threerings.crowd.client.PlaceView;
|
||||
import com.threerings.crowd.util.CrowdContext;
|
||||
|
||||
import com.threerings.crowd.chat.client.ChatDirector;
|
||||
|
||||
public class MsoyContext
|
||||
implements CrowdContext
|
||||
{
|
||||
public function MsoyContext (client :Client, app :Application)
|
||||
{
|
||||
_client = client;
|
||||
_app = app;
|
||||
|
||||
// TODO: verify params to these constructors
|
||||
_msgmgr = new MessageManager("rsrc");
|
||||
_locdir = new LocationDirector(this);
|
||||
_chatdir = new ChatDirector(this, _msgmgr, "general");
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface PresentsContext
|
||||
public function getClient () :Client
|
||||
{
|
||||
return _client;
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface PresentsContext
|
||||
public function getDObjectManager () :DObjectManager
|
||||
{
|
||||
return _client.getDObjectManager();
|
||||
}
|
||||
|
||||
// documentation inherited from interface CrowdContext
|
||||
public function getLocationDirector () :LocationDirector
|
||||
{
|
||||
return _locdir;
|
||||
}
|
||||
|
||||
// documentation inherited from interface CrowdContext
|
||||
public function getOccupantDirector () :OccupantDirector
|
||||
{
|
||||
return null; // TODO
|
||||
}
|
||||
|
||||
// documentation inherited from interface CrowdContext
|
||||
public function getChatDirector () :ChatDirector
|
||||
{
|
||||
return _chatdir;
|
||||
}
|
||||
|
||||
// documentation inherited from interface CrowdContext
|
||||
public function setPlaceView (view :PlaceView) :void
|
||||
{
|
||||
for (var ii :int = _app.numChildren - 1; ii >= 0; ii--) {
|
||||
_app.removeChildAt(ii);
|
||||
}
|
||||
|
||||
_app.addChild(view as DisplayObject);
|
||||
}
|
||||
|
||||
// documentation inherited from interface CrowdContext
|
||||
public function clearPlaceView (view :PlaceView) :void
|
||||
{
|
||||
_app.removeChild(view as DisplayObject);
|
||||
}
|
||||
|
||||
protected var _client :Client;
|
||||
|
||||
protected var _app :Application;
|
||||
|
||||
protected var _msgmgr :MessageManager;
|
||||
|
||||
protected var _locdir :LocationDirector;
|
||||
|
||||
protected var _chatdir :ChatDirector;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.threerings.msoy.client {
|
||||
|
||||
import com.threerings.crowd.client.PlaceController;
|
||||
import com.threerings.crowd.client.PlaceView;
|
||||
import com.threerings.crowd.util.CrowdContext;
|
||||
|
||||
public class SimpleChatController extends PlaceController
|
||||
{
|
||||
// documentation inherited
|
||||
protected override function createPlaceView (ctx :CrowdContext) :PlaceView
|
||||
{
|
||||
return new SimpleChatPanel(ctx as MsoyContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
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
|
||||
{
|
||||
public function SimpleChatPanel (ctx :MsoyContext)
|
||||
{
|
||||
addChild(new ChatTextArea(ctx));
|
||||
addChild(new ChatControl(ctx));
|
||||
}
|
||||
|
||||
// documentation inherited from interface PlaceView
|
||||
public function willEnterPlace (plobj :PlaceObject) :void
|
||||
{
|
||||
}
|
||||
|
||||
// documentation inherited from interface PlaceView
|
||||
public function didLeavePlace (plobj :PlaceObject) :void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.threerings.msoy.data {
|
||||
|
||||
import com.threerings.crowd.data.PlaceConfig;
|
||||
|
||||
import com.threerings.msoy.client.SimpleChatController;
|
||||
|
||||
public class SimpleChatConfig extends PlaceConfig
|
||||
{
|
||||
// documentation inherited
|
||||
public override function getControllerClass () :Class
|
||||
{
|
||||
return SimpleChatController;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user