Factored some of the move preparation code out so that the new
ZoneDirector can extend the moveTo process to incorporate zones. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@726 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SceneDirector.java,v 1.7 2001/11/12 20:56:55 mdb Exp $
|
// $Id: SceneDirector.java,v 1.8 2001/12/04 00:30:27 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.whirled.client;
|
package com.threerings.whirled.client;
|
||||||
|
|
||||||
@@ -70,11 +70,35 @@ public class SceneDirector
|
|||||||
* will be notified of success or failure.
|
* will be notified of success or failure.
|
||||||
*/
|
*/
|
||||||
public void moveTo (int sceneId)
|
public void moveTo (int sceneId)
|
||||||
|
{
|
||||||
|
// prepare to move to this scene (sets up pending data)
|
||||||
|
if (!prepareMoveTo(sceneId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the version of our cached copy of the scene to which
|
||||||
|
// we're requesting to move; if we were unable to load it, assume
|
||||||
|
// a cached version of zero
|
||||||
|
int sceneVers = 0;
|
||||||
|
if (_pendingModel != null) {
|
||||||
|
sceneVers = _pendingModel.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
// issue a moveTo request
|
||||||
|
SceneService.moveTo(_ctx.getClient(), sceneId, sceneVers, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares to move to the requested scene. The location observers are
|
||||||
|
* asked to ratify the move and our pending scene mode is loaded from
|
||||||
|
* the scene repository.
|
||||||
|
*/
|
||||||
|
protected boolean prepareMoveTo (int sceneId)
|
||||||
{
|
{
|
||||||
// first check to see if our observers are happy with this move
|
// first check to see if our observers are happy with this move
|
||||||
// request
|
// request
|
||||||
if (!mayMoveTo(sceneId)) {
|
if (!mayMoveTo(sceneId)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// complain if we're over-writing a pending request
|
// complain if we're over-writing a pending request
|
||||||
@@ -92,18 +116,13 @@ public class SceneDirector
|
|||||||
|
|
||||||
// load up the pending scene so that we can communicate it's most
|
// load up the pending scene so that we can communicate it's most
|
||||||
// recent version to the server
|
// recent version to the server
|
||||||
int sceneVers = 0;
|
|
||||||
_pendingModel = loadSceneModel(sceneId);
|
_pendingModel = loadSceneModel(sceneId);
|
||||||
// if we were unable to load it, assume a previous version of zero
|
|
||||||
if (_pendingModel != null) {
|
|
||||||
sceneVers = _pendingModel.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make a note of our pending scene id
|
// make a note of our pending scene id
|
||||||
_pendingSceneId = sceneId;
|
_pendingSceneId = sceneId;
|
||||||
|
|
||||||
// issue a moveTo request
|
// all systems go
|
||||||
SceneService.moveTo(_ctx.getClient(), sceneId, sceneVers, this);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user