Major surgery to bring Whirled into line with the new PlaceConfig world
order. Also moved stuff from whirled.client.test and whirled.server.test into whirled.test because it's silly having two separate test directories. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@401 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneDirector.java,v 1.4 2001/10/02 02:08:16 mdb Exp $
|
||||
// $Id: SceneDirector.java,v 1.5 2001/10/05 23:59:36 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.client;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.threerings.cocktail.cher.dobj.ObjectAccessException;
|
||||
|
||||
import com.threerings.cocktail.party.client.LocationDirector;
|
||||
import com.threerings.cocktail.party.client.LocationObserver;
|
||||
import com.threerings.cocktail.party.data.PlaceConfig;
|
||||
import com.threerings.cocktail.party.data.PlaceObject;
|
||||
|
||||
import com.threerings.whirled.Log;
|
||||
@@ -101,11 +102,12 @@ public class SceneDirector
|
||||
/**
|
||||
* Called in response to a successful <code>moveTo</code> request.
|
||||
*/
|
||||
public void handleMoveSucceeded (int invid, int placeId)
|
||||
public void handleMoveSucceeded (
|
||||
int invid, int placeId, PlaceConfig config)
|
||||
{
|
||||
// our move request was successful, deal with subscribing to our
|
||||
// new place object
|
||||
didMoveTo(placeId);
|
||||
didMoveTo(placeId, config);
|
||||
|
||||
// since we're committed to moving to the new scene, we'll
|
||||
// parallelize and go ahead and load up the new scene now rather
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
//
|
||||
// $Id: DummyScene.java,v 1.3 2001/09/21 00:21:40 mdb Exp $
|
||||
// $Id: DummyScene.java,v 1.4 2001/10/05 23:59:37 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.client.test;
|
||||
package com.threerings.whirled.test;
|
||||
|
||||
import com.threerings.cocktail.party.data.PlaceConfig;
|
||||
import com.threerings.whirled.data.Scene;
|
||||
|
||||
public class DummyScene implements Scene
|
||||
@@ -32,5 +33,10 @@ public class DummyScene implements Scene
|
||||
return null;
|
||||
}
|
||||
|
||||
public PlaceConfig getPlaceConfig ()
|
||||
{
|
||||
return new TestConfig();
|
||||
}
|
||||
|
||||
protected int _sceneId;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: EditableScene.java,v 1.2 2001/09/28 01:46:10 mdb Exp $
|
||||
// $Id: EditableScene.java,v 1.3 2001/10/05 23:59:36 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.data;
|
||||
|
||||
@@ -19,9 +19,4 @@ public interface EditableScene extends Scene
|
||||
* Updates the scene's version.
|
||||
*/
|
||||
public void setVersion (int version);
|
||||
|
||||
/**
|
||||
* Updates the scene's name.
|
||||
*/
|
||||
public void setName (String name);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
//
|
||||
// $Id: Scene.java,v 1.4 2001/09/21 02:30:35 mdb Exp $
|
||||
// $Id: Scene.java,v 1.5 2001/10/05 23:59:36 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.data;
|
||||
|
||||
import com.threerings.cocktail.party.data.PlaceConfig;
|
||||
|
||||
/**
|
||||
* The base scene interface. This encapsulates the minimum information
|
||||
* needed about a scene in the Whirled system.
|
||||
*/
|
||||
public interface Scene
|
||||
{
|
||||
/** Scene id to denote an unset or otherwise invalid scene id. */
|
||||
public static final int SID_INVALID = -1;
|
||||
|
||||
/**
|
||||
* Returns the scene's unique identifier.
|
||||
*/
|
||||
@@ -25,15 +24,22 @@ public interface Scene
|
||||
*/
|
||||
public int getVersion ();
|
||||
|
||||
/**
|
||||
* Returns the scene's name. Every scene has a descriptive name.
|
||||
*/
|
||||
public String getName ();
|
||||
|
||||
/**
|
||||
* Returns the scene ids of all scenes that neighbor this scene. A
|
||||
* neighboring scene is one to which the user can traverse from this
|
||||
* scene and vice versa.
|
||||
*/
|
||||
public int[] getNeighborIds ();
|
||||
|
||||
/**
|
||||
* A scene is associated with a place on the server. Because the
|
||||
* scenes are loaded on demand, the scene implementation must be able
|
||||
* to provide a place config instance for each scene. This will allow
|
||||
* the server to figure out what manager class to instantiate to
|
||||
* manage the scene and all the client to figure out what controller
|
||||
* class to instantiate to controll the scene. Additionally, it may
|
||||
* contain runtime configuration information needed by the application
|
||||
* using the Whirled services.
|
||||
*/
|
||||
public PlaceConfig getPlaceConfig ();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneManager.java,v 1.4 2001/09/05 01:08:30 shaper Exp $
|
||||
// $Id: SceneManager.java,v 1.5 2001/10/05 23:59:36 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server;
|
||||
|
||||
@@ -11,6 +11,10 @@ import com.threerings.whirled.data.Scene;
|
||||
|
||||
public class SceneManager extends PlaceManager
|
||||
{
|
||||
/**
|
||||
* Returns the scene object (not the scene distributed object)
|
||||
* associated with this scene.
|
||||
*/
|
||||
public Scene getScene ()
|
||||
{
|
||||
return _scene;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//
|
||||
// $Id: SceneProvider.java,v 1.2 2001/10/01 22:16:02 mdb Exp $
|
||||
// $Id: SceneProvider.java,v 1.3 2001/10/05 23:59:36 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server;
|
||||
|
||||
import com.threerings.cocktail.cher.server.InvocationProvider;
|
||||
import com.threerings.cocktail.cher.server.ServiceFailedException;
|
||||
|
||||
import com.threerings.cocktail.party.data.BodyObject;
|
||||
import com.threerings.cocktail.party.data.PlaceObject;
|
||||
import com.threerings.cocktail.party.data.*;
|
||||
import com.threerings.cocktail.party.server.LocationProvider;
|
||||
|
||||
import com.threerings.whirled.Log;
|
||||
@@ -67,19 +67,19 @@ public class SceneProvider
|
||||
PlaceObject plobj = scmgr.getPlaceObject();
|
||||
int ploid = plobj.getOid();
|
||||
|
||||
// try doing the actual move
|
||||
String rcode = LocationProvider.moveTo(source, ploid);
|
||||
try {
|
||||
// try doing the actual move
|
||||
PlaceConfig config = LocationProvider.moveTo(source, ploid);
|
||||
|
||||
// if the move failed, let them know
|
||||
if (!rcode.equals(SUCCESS)) {
|
||||
sendResponse(source, invid, MOVE_FAILED_RESPONSE, rcode);
|
||||
return;
|
||||
// check to see if they need a newer version of the scene data
|
||||
|
||||
// then send the moveTo response
|
||||
sendResponse(source, invid, MOVE_SUCCEEDED_RESPONSE,
|
||||
new Integer(ploid), config);
|
||||
|
||||
} catch (ServiceFailedException sfe) {
|
||||
sendResponse(source, invid, MOVE_FAILED_RESPONSE,
|
||||
sfe.getMessage());
|
||||
}
|
||||
|
||||
// otherwise check to see if they need a newer version of the
|
||||
// scene data
|
||||
|
||||
sendResponse(source, invid, MOVE_SUCCEEDED_RESPONSE,
|
||||
new Integer(ploid));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneRegistry.java,v 1.3 2001/10/02 02:08:16 mdb Exp $
|
||||
// $Id: SceneRegistry.java,v 1.4 2001/10/05 23:59:36 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class SceneRegistry
|
||||
* active. The supplied callback instance will be notified, on the
|
||||
* dobjmgr thread, when the scene has been resolved. If the scene is
|
||||
* already active, it will be notified immediately (before the call to
|
||||
* <code>resolveScene</code> returns).
|
||||
* {@link #resolveScene} returns).
|
||||
*
|
||||
* @param sceneId the id of the scene to resolve.
|
||||
* @param resolver a reference to a callback instance that will be
|
||||
@@ -161,7 +161,7 @@ public class SceneRegistry
|
||||
|
||||
try {
|
||||
SceneManager scmgr = (SceneManager)
|
||||
PartyServer.plreg.createPlace(SceneManager.class);
|
||||
PartyServer.plreg.createPlace(scene.getPlaceConfig());
|
||||
|
||||
// configure the scene manager with references to useful
|
||||
// stuff; we'll somehow need to convey configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: WhirledServer.java,v 1.5 2001/10/02 02:08:16 mdb Exp $
|
||||
// $Id: WhirledServer.java,v 1.6 2001/10/05 23:59:36 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server;
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.threerings.cocktail.party.server.PartyServer;
|
||||
|
||||
import com.threerings.whirled.Log;
|
||||
import com.threerings.whirled.server.persist.SceneRepository;
|
||||
import com.threerings.whirled.server.test.DummySceneRepository;
|
||||
import com.threerings.whirled.test.DummySceneRepository;
|
||||
|
||||
/**
|
||||
* The whirled server extends the party server and provides access to
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: DummySceneRepository.java,v 1.3 2001/09/21 03:15:02 mdb Exp $
|
||||
// $Id: DummySceneRepository.java,v 1.4 2001/10/05 23:59:37 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server.test;
|
||||
package com.threerings.whirled.test;
|
||||
|
||||
import com.samskivert.io.PersistenceException;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user