Added support for initiating a place/scene/zone transition from the
server; chat director no longer needs to wait until we're logged on to register itself with the invocation director. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1393 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ZoneDirector.java,v 1.4 2001/12/17 04:11:40 mdb Exp $
|
||||
// $Id: ZoneDirector.java,v 1.5 2002/05/26 02:24:46 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.zone.client;
|
||||
|
||||
@@ -149,6 +149,24 @@ public class ZoneDirector
|
||||
notifyObservers(reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server has decided to forcibly move us to another
|
||||
* zone and scene. The server first ejects us from our previous scene
|
||||
* and then sends us a notification with our new location. We then
|
||||
* turn around and issue a standard moveTo request.
|
||||
*/
|
||||
public void handleMoveNotification (int zoneId, int sceneId)
|
||||
{
|
||||
Log.info("Moving at request of server [zoneId=" + zoneId +
|
||||
", sceneId=" + sceneId + "].");
|
||||
|
||||
// clear out our old scene and place data
|
||||
_scdir.didLeaveScene();
|
||||
|
||||
// move to the new zone and scene
|
||||
moveTo(zoneId, sceneId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies observers of success or failure, depending on the type of
|
||||
* object provided as data.
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
//
|
||||
// $Id: ZoneProvider.java,v 1.7 2002/05/03 00:00:17 mdb Exp $
|
||||
// $Id: ZoneProvider.java,v 1.8 2002/05/26 02:24:46 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.zone.server;
|
||||
|
||||
import com.threerings.presents.server.InvocationManager;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
import com.threerings.presents.server.ServiceFailedException;
|
||||
|
||||
@@ -33,8 +34,10 @@ public class ZoneProvider
|
||||
* constructed and registered by the {@link ZoneRegistry}, which a
|
||||
* zone-using system must create and initialize in their server.
|
||||
*/
|
||||
public ZoneProvider (ZoneRegistry zonereg, SceneRegistry screg)
|
||||
public ZoneProvider (
|
||||
InvocationManager invmgr, ZoneRegistry zonereg, SceneRegistry screg)
|
||||
{
|
||||
_invmgr = invmgr;
|
||||
_zonereg = zonereg;
|
||||
_screg = screg;
|
||||
}
|
||||
@@ -174,6 +177,25 @@ public class ZoneProvider
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ejects the specified body from their current scene and sends them a
|
||||
* request to move to the specified new zone and scene. This is the
|
||||
* zone-equivalent to {@link LocationProvider#moveBody}.
|
||||
*/
|
||||
public void moveBody (BodyObject source, int zoneId, int sceneId)
|
||||
{
|
||||
// first remove them from their old place
|
||||
LocationProvider.leaveOccupiedPlace(source);
|
||||
|
||||
// then send a move notification
|
||||
_invmgr.sendNotification(
|
||||
source.getOid(), MODULE_NAME, MOVE_NOTIFICATION,
|
||||
new Object[] { new Integer(zoneId), new Integer(sceneId) });
|
||||
}
|
||||
|
||||
/** The invocation manager with which we interact. */
|
||||
protected InvocationManager _invmgr;
|
||||
|
||||
/** The zone registry with which we communicate. */
|
||||
protected ZoneRegistry _zonereg;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ZoneRegistry.java,v 1.6 2002/03/28 23:59:33 mdb Exp $
|
||||
// $Id: ZoneRegistry.java,v 1.7 2002/05/26 02:24:46 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.zone.server;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ZoneRegistry
|
||||
{
|
||||
// create a zone provider and register it with the invocation
|
||||
// services
|
||||
ZoneProvider provider = new ZoneProvider(this, screg);
|
||||
ZoneProvider provider = new ZoneProvider(invmgr, this, screg);
|
||||
invmgr.registerProvider(ZoneProvider.MODULE_NAME, provider);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user