Some tweaks to the simulator services.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2900 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SimpleClient.java,v 1.9 2003/11/24 17:51:56 mdb Exp $
|
||||
// $Id: SimpleClient.java,v 1.10 2003/12/10 03:31:41 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.simulator.client;
|
||||
|
||||
@@ -36,13 +36,13 @@ public class SimpleClient
|
||||
throws IOException
|
||||
{
|
||||
// create our context
|
||||
_ctx = new MiCasaContextImpl();
|
||||
_ctx = createContext();
|
||||
|
||||
// create the handles on our various services
|
||||
_client = new Client(null, this);
|
||||
|
||||
// create our managers and directors
|
||||
_msgmgr = new MessageManager("rsrc");
|
||||
_msgmgr = new MessageManager(getMessageManagerPrefix());
|
||||
_locdir = new LocationDirector(_ctx);
|
||||
_occdir = new OccupantDirector(_ctx);
|
||||
_pardtr = new ParlorDirector(_ctx);
|
||||
@@ -61,6 +61,23 @@ public class SimpleClient
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates our context reference.
|
||||
*/
|
||||
protected MiCasaContext createContext ()
|
||||
{
|
||||
return new MiCasaContextImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the prefix used by the message manager when looking for
|
||||
* translation properties files.
|
||||
*/
|
||||
protected String getMessageManagerPrefix ()
|
||||
{
|
||||
return "rsrc";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the context in effect for this client. This
|
||||
* reference is valid for the lifetime of the application.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SimulatorApp.java,v 1.13 2002/11/12 19:54:05 shaper Exp $
|
||||
// $Id: SimulatorApp.java,v 1.14 2003/12/10 03:31:41 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.simulator.client;
|
||||
|
||||
@@ -7,6 +7,8 @@ import javax.swing.JFrame;
|
||||
|
||||
import com.samskivert.swing.Controller;
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
import com.samskivert.util.Interval;
|
||||
import com.samskivert.util.IntervalManager;
|
||||
import com.samskivert.util.ResultListener;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
@@ -139,7 +141,18 @@ public class SimulatorApp
|
||||
// create and set our credentials
|
||||
Credentials creds = new UsernamePasswordCreds(username, password);
|
||||
client.setCredentials(creds);
|
||||
client.logon();
|
||||
|
||||
// this is a bit of a hack, but we need to give the server long
|
||||
// enough to fully initialize and start listening on its socket
|
||||
// before we try to logon; there's no good way for this otherwise
|
||||
// wholly independent thread to wait for the server to be ready as
|
||||
// in normal circumstances they are entirely different processes;
|
||||
// so we just wait half a second which does the job
|
||||
IntervalManager.register(new Interval() {
|
||||
public void intervalExpired (int id, Object arg) {
|
||||
_client.getParlorContext().getClient().logon();
|
||||
}
|
||||
}, 500L, null, false);
|
||||
}
|
||||
|
||||
public static void main (String[] args)
|
||||
|
||||
Reference in New Issue
Block a user