zone moves and portal traversals can now have an optional result listener

passed in.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1460 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-06-14 01:40:16 +00:00
parent 891e1a319f
commit 36a8a9672f
6 changed files with 89 additions and 12 deletions
@@ -1,10 +1,11 @@
//
// $Id: SceneDirector.java,v 1.18 2002/06/14 01:24:49 mdb Exp $
// $Id: SceneDirector.java,v 1.19 2002/06/14 01:40:16 ray Exp $
package com.threerings.whirled.client;
import java.io.IOException;
import com.samskivert.util.HashIntMap;
import com.samskivert.util.ResultListener;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationReceiver;
@@ -101,7 +102,7 @@ public class SceneDirector
}
// prepare to move to this scene (sets up pending data)
if (!prepareMoveTo(sceneId)) {
if (!prepareMoveTo(sceneId, null)) {
return false;
}
@@ -124,11 +125,11 @@ public class SceneDirector
* the scene repository. This can be called by cooperating directors
* that need to coopt the moveTo process.
*/
public boolean prepareMoveTo (int sceneId)
public boolean prepareMoveTo (int sceneId, ResultListener rl)
{
// first check to see if our observers are happy with this move
// request
if (!_locdir.mayMoveTo(sceneId)) {
if (!_locdir.mayMoveTo(sceneId, rl)) {
return false;
}
@@ -1,9 +1,10 @@
//
// $Id: SpotSceneDirector.java,v 1.13 2002/06/14 01:27:53 mdb Exp $
// $Id: SpotSceneDirector.java,v 1.14 2002/06/14 01:40:16 ray Exp $
package com.threerings.whirled.spot.client;
import java.util.Iterator;
import com.samskivert.util.ResultListener;
import com.samskivert.util.StringUtil;
import com.threerings.presents.dobj.DObject;
@@ -93,6 +94,17 @@ public class SpotSceneDirector
* a location observer or because we have another request outstanding.
*/
public boolean traversePortal (int portalId)
{
return traversePortal(portalId, null);
}
/**
* Requests that this client move to the location specified by the
* supplied portal id. A request will be made and when the response is
* received, the location observers will be notified of success or
* failure.
*/
public boolean traversePortal (int portalId, ResultListener rl)
{
// look up the destination scene and location
DisplaySpotScene scene = (DisplaySpotScene)_scdir.getScene();
@@ -122,7 +134,7 @@ public class SpotSceneDirector
}
// prepare to move to this scene (sets up pending data)
if (!_scdir.prepareMoveTo(targetSceneId)) {
if (!_scdir.prepareMoveTo(targetSceneId, rl)) {
return false;
}
@@ -1,10 +1,12 @@
//
// $Id: ZoneDirector.java,v 1.7 2002/06/14 01:24:49 mdb Exp $
// $Id: ZoneDirector.java,v 1.8 2002/06/14 01:40:16 ray Exp $
package com.threerings.whirled.zone.client;
import java.util.ArrayList;
import com.samskivert.util.ResultListener;
import com.threerings.presents.client.InvocationReceiver;
import com.threerings.crowd.data.PlaceConfig;
@@ -77,6 +79,16 @@ public class ZoneDirector
* location observers will be notified of success or failure.
*/
public boolean moveTo (int zoneId, int sceneId)
{
return moveTo(zoneId, sceneId, null);
}
/**
* Requests that this client move the specified scene in the specified
* zone. A request will be made and when the response is received, the
* location observers will be notified of success or failure.
*/
public boolean moveTo (int zoneId, int sceneId, ResultListener rl)
{
// if the requested zone is the same as our current zone, we just
// want a regular old moveTo request
@@ -86,7 +98,7 @@ public class ZoneDirector
// otherwise, we make a zoned moveTo request; prepare to move to
// this scene (sets up pending data)
if (!_scdir.prepareMoveTo(sceneId)) {
if (!_scdir.prepareMoveTo(sceneId, rl)) {
return false;
}
@@ -171,7 +183,7 @@ public class ZoneDirector
_scdir.didLeaveScene();
// move to the new zone and scene
moveTo(zoneId, sceneId);
moveTo(zoneId, sceneId, null);
}
/**