From 31a01774804af4a943c40c0328e2f036e5c9f2b9 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 9 Oct 2001 00:48:34 +0000 Subject: [PATCH] Updated to conform to new place services provided by party. Getting closer to being able to launch a game. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@406 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- rsrc/config/micasa/server.properties | 4 +- .../micasa/client/ClientController.java | 7 +-- .../micasa/client/OccupantList.java | 4 +- .../threerings/micasa/lobby/LobbyConfig.java | 45 +++++++++++++++++++ .../micasa/lobby/LobbyController.java | 26 +++++++++++ .../micasa/lobby/LobbyRegistry.java | 12 ++--- 6 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 src/java/com/threerings/micasa/lobby/LobbyConfig.java create mode 100644 src/java/com/threerings/micasa/lobby/LobbyController.java diff --git a/rsrc/config/micasa/server.properties b/rsrc/config/micasa/server.properties index f9b0f95ab..62fbe14ae 100644 --- a/rsrc/config/micasa/server.properties +++ b/rsrc/config/micasa/server.properties @@ -1,5 +1,5 @@ # -# $Id: server.properties,v 1.2 2001/10/04 23:41:44 mdb Exp $ +# $Id: server.properties,v 1.3 2001/10/09 00:48:34 mdb Exp $ # # Configuration for the MiCasa server @@ -11,6 +11,6 @@ lobby_ids = test # # The cofiguration for the test lobby. # -test.mgrclass = com.threerings.micasa.lobby.LobbyManager +test.config = com.threerings.micasa.lobby.LobbyConfig test.ugi = test,board,partner test.name = Test Lobby diff --git a/src/java/com/threerings/micasa/client/ClientController.java b/src/java/com/threerings/micasa/client/ClientController.java index d1a912650..92cb93d0c 100644 --- a/src/java/com/threerings/micasa/client/ClientController.java +++ b/src/java/com/threerings/micasa/client/ClientController.java @@ -1,5 +1,5 @@ // -// $Id: ClientController.java,v 1.2 2001/10/04 23:41:44 mdb Exp $ +// $Id: ClientController.java,v 1.3 2001/10/09 00:48:34 mdb Exp $ package com.threerings.micasa.client; @@ -14,7 +14,6 @@ import com.threerings.cocktail.cher.net.UsernamePasswordCreds; import com.threerings.cocktail.party.client.*; import com.threerings.cocktail.party.data.*; -import com.threerings.cocktail.party.util.PlaceViewUtil; import com.threerings.media.sprite.SpriteManager; @@ -133,8 +132,9 @@ public class ClientController // clean up after the old place if (_place != null) { - _place.removeSubscriber(this); + // dispatch didLeavePlace to our views PlaceViewUtil.dispatchDidLeavePlace(_frame, _place); + _place.removeSubscriber(this); } _place = place; @@ -142,6 +142,7 @@ public class ClientController // and enter the new place with bells on if (_place != null) { _place.addSubscriber(this); + // dispatch willEnterPlace to our views PlaceViewUtil.dispatchWillEnterPlace(_frame, _place); } } diff --git a/src/java/com/threerings/micasa/client/OccupantList.java b/src/java/com/threerings/micasa/client/OccupantList.java index 3893cec21..34453a939 100644 --- a/src/java/com/threerings/micasa/client/OccupantList.java +++ b/src/java/com/threerings/micasa/client/OccupantList.java @@ -1,5 +1,5 @@ // -// $Id: OccupantList.java,v 1.1 2001/10/04 23:41:44 mdb Exp $ +// $Id: OccupantList.java,v 1.2 2001/10/09 00:48:34 mdb Exp $ package com.threerings.micasa.client; @@ -7,9 +7,9 @@ import java.util.Iterator; import javax.swing.*; import com.threerings.cocktail.party.client.OccupantObserver; +import com.threerings.cocktail.party.client.PlaceView; import com.threerings.cocktail.party.data.OccupantInfo; import com.threerings.cocktail.party.data.PlaceObject; -import com.threerings.cocktail.party.util.PlaceView; import com.threerings.micasa.util.MiCasaContext; diff --git a/src/java/com/threerings/micasa/lobby/LobbyConfig.java b/src/java/com/threerings/micasa/lobby/LobbyConfig.java new file mode 100644 index 000000000..f2763eee5 --- /dev/null +++ b/src/java/com/threerings/micasa/lobby/LobbyConfig.java @@ -0,0 +1,45 @@ +// +// $Id: LobbyConfig.java,v 1.1 2001/10/09 00:48:34 mdb Exp $ + +package com.threerings.micasa.lobby; + +import java.io.IOException; +import java.io.DataInputStream; +import java.io.DataOutputStream; + +import com.threerings.cocktail.party.data.PlaceConfig; + +public class LobbyConfig extends PlaceConfig +{ + // documentation inherited + public Class getControllerClass () + { + return LobbyController.class; + } + + // documentation inherited + public String getManagerClassName () + { + return "com.threerings.micasa.lobby.LobbyManager"; + } + + // documentation inherited + public void writeTo (DataOutputStream out) + throws IOException + { + super.writeTo(out); + } + + // documentation inherited + public void readFrom (DataInputStream in) + throws IOException + { + super.readFrom(in); + } + + // documentation inherited + protected void toString (StringBuffer buf) + { + super.toString(buf); + } +} diff --git a/src/java/com/threerings/micasa/lobby/LobbyController.java b/src/java/com/threerings/micasa/lobby/LobbyController.java new file mode 100644 index 000000000..7cdb6e927 --- /dev/null +++ b/src/java/com/threerings/micasa/lobby/LobbyController.java @@ -0,0 +1,26 @@ +// +// $Id: LobbyController.java,v 1.1 2001/10/09 00:48:34 mdb Exp $ + +package com.threerings.micasa.lobby; + +import com.threerings.cocktail.party.data.PlaceConfig; +import com.threerings.cocktail.party.client.PlaceController; +import com.threerings.cocktail.party.client.PlaceView; +import com.threerings.cocktail.party.util.PartyContext; + +import com.threerings.micasa.Log; + +public class LobbyController extends PlaceController +{ + public void init (PartyContext ctx, PlaceConfig config) + { + super.init(ctx, config); + + Log.info("Lobby controller created [config=" + config + "]."); + } + + protected PlaceView createPlaceView () + { + return null; + } +} diff --git a/src/java/com/threerings/micasa/lobby/LobbyRegistry.java b/src/java/com/threerings/micasa/lobby/LobbyRegistry.java index d77534101..d924071c7 100644 --- a/src/java/com/threerings/micasa/lobby/LobbyRegistry.java +++ b/src/java/com/threerings/micasa/lobby/LobbyRegistry.java @@ -1,5 +1,5 @@ // -// $Id: LobbyRegistry.java,v 1.2 2001/10/04 23:41:44 mdb Exp $ +// $Id: LobbyRegistry.java,v 1.3 2001/10/09 00:48:34 mdb Exp $ package com.threerings.micasa.lobby; @@ -106,15 +106,17 @@ public class LobbyRegistry implements LobbyCodes props = PropertiesUtil.getSubProperties(props, lobbyId); // get the lobby manager class and UGI - String lmgrClass = props.getProperty("mgrclass"); - if (StringUtil.blank(lmgrClass)) { - throw new Exception("Missing 'mgrclass' definition in " + + String cfgClass = props.getProperty("config"); + if (StringUtil.blank(cfgClass)) { + throw new Exception("Missing 'config' definition in " + "lobby configuration."); } // instantiate the manager class and create the lobby + LobbyConfig config = (LobbyConfig) + Class.forName(cfgClass).newInstance(); LobbyManager lobmgr = (LobbyManager) - MiCasaServer.plreg.createPlace(Class.forName(lmgrClass)); + MiCasaServer.plreg.createPlace(config); // initialize the lobby manager. it will call lobbyReady() // when it has obtained a reference to its lobby object and is