Depends injection and other cleanup.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@634 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -21,30 +21,33 @@
|
||||
|
||||
package com.threerings.micasa.server;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import com.threerings.presents.net.BootstrapData;
|
||||
import com.threerings.crowd.server.CrowdClient;
|
||||
|
||||
import com.threerings.micasa.data.MiCasaBootstrapData;
|
||||
import com.threerings.micasa.lobby.LobbyRegistry;
|
||||
|
||||
/**
|
||||
* Extends the Crowd client and provides bootstrap data specific to the
|
||||
* MiCasa services.
|
||||
* Extends the Crowd client and provides bootstrap data specific to the MiCasa services.
|
||||
*/
|
||||
public class MiCasaClient extends CrowdClient
|
||||
{
|
||||
// documentation inherited
|
||||
@Override // from PresentsClient
|
||||
protected BootstrapData createBootstrapData ()
|
||||
{
|
||||
return new MiCasaBootstrapData();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@Override // from PresentsClient
|
||||
protected void populateBootstrapData (BootstrapData data)
|
||||
{
|
||||
super.populateBootstrapData(data);
|
||||
|
||||
// let the client know their default lobby oid
|
||||
((MiCasaBootstrapData)data).defLobbyOid =
|
||||
MiCasaServer.lobreg.getDefaultLobbyOid();
|
||||
((MiCasaBootstrapData)data).defLobbyOid = _lobreg.getDefaultLobbyOid();
|
||||
}
|
||||
|
||||
@Inject protected LobbyRegistry _lobreg;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.threerings.micasa.server;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
@@ -40,16 +41,21 @@ import com.threerings.micasa.lobby.LobbyRegistry;
|
||||
import static com.threerings.micasa.Log.log;
|
||||
|
||||
/**
|
||||
* This class is the main entry point and general organizer of everything
|
||||
* that goes on in the MiCasa game server process.
|
||||
* The main general organizer of everything that goes on in the MiCasa game server process.
|
||||
*/
|
||||
public class MiCasaServer extends CrowdServer
|
||||
{
|
||||
/** The parlor manager in operation on this server. */
|
||||
public static ParlorManager parmgr = new ParlorManager();
|
||||
|
||||
/** The lobby registry operating on this server. */
|
||||
public static LobbyRegistry lobreg = new LobbyRegistry();
|
||||
public static void main (String[] args)
|
||||
{
|
||||
Injector injector = Guice.createInjector(new Module());
|
||||
MiCasaServer server = injector.getInstance(MiCasaServer.class);
|
||||
try {
|
||||
server.init(injector);
|
||||
server.run();
|
||||
} catch (Exception e) {
|
||||
log.warning("Unable to initialize server.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // from CrowdServer
|
||||
public void init (Injector injector)
|
||||
@@ -67,24 +73,12 @@ public class MiCasaServer extends CrowdServer
|
||||
}
|
||||
});
|
||||
|
||||
// initialize our parlor manager
|
||||
parmgr.init(invmgr, plreg);
|
||||
|
||||
// initialize the lobby registry
|
||||
lobreg.init(invmgr);
|
||||
_lobreg.init();
|
||||
|
||||
log.info("MiCasa server initialized.");
|
||||
}
|
||||
|
||||
public static void main (String[] args)
|
||||
{
|
||||
Injector injector = Guice.createInjector(new Module());
|
||||
MiCasaServer server = injector.getInstance(MiCasaServer.class);
|
||||
try {
|
||||
server.init(injector);
|
||||
server.run();
|
||||
} catch (Exception e) {
|
||||
log.warning("Unable to initialize server.", e);
|
||||
}
|
||||
}
|
||||
@Inject protected LobbyRegistry _lobreg;
|
||||
@Inject protected ParlorManager _parmgr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user