The SceneDirector should observer location changes so that it can clear out its
current scene information if we move to a non-scene location. Previously when we did so, it simply didn't notice and thought we were still in the last scene that we had occupied. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@369 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -39,15 +39,17 @@ import com.threerings.crowd.client.LocationDirector;
|
|||||||
import com.threerings.crowd.client.LocationDirector_FailureHandler;
|
import com.threerings.crowd.client.LocationDirector_FailureHandler;
|
||||||
import com.threerings.crowd.client.LocationObserver;
|
import com.threerings.crowd.client.LocationObserver;
|
||||||
import com.threerings.crowd.data.PlaceConfig;
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
import com.threerings.whirled.client.persist.SceneRepository;
|
import com.threerings.whirled.client.persist.SceneRepository;
|
||||||
import com.threerings.whirled.data.Scene;
|
import com.threerings.whirled.data.Scene;
|
||||||
import com.threerings.whirled.data.SceneCodes;
|
import com.threerings.whirled.data.SceneCodes;
|
||||||
import com.threerings.whirled.data.SceneModel;
|
import com.threerings.whirled.data.SceneModel;
|
||||||
|
import com.threerings.whirled.data.SceneObject;
|
||||||
|
import com.threerings.whirled.data.SceneUpdate;
|
||||||
import com.threerings.whirled.util.NoSuchSceneError;
|
import com.threerings.whirled.util.NoSuchSceneError;
|
||||||
import com.threerings.whirled.util.SceneFactory;
|
import com.threerings.whirled.util.SceneFactory;
|
||||||
import com.threerings.whirled.util.WhirledContext;
|
import com.threerings.whirled.util.WhirledContext;
|
||||||
import com.threerings.whirled.data.SceneUpdate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scene director is the client's interface to all things scene related. It interfaces with the
|
* The scene director is the client's interface to all things scene related. It interfaces with the
|
||||||
@@ -60,7 +62,8 @@ import com.threerings.whirled.data.SceneUpdate;
|
|||||||
* LocationObserver#locationChangeFailed}.
|
* LocationObserver#locationChangeFailed}.
|
||||||
*/
|
*/
|
||||||
public class SceneDirector extends BasicDirector
|
public class SceneDirector extends BasicDirector
|
||||||
implements LocationDirector_FailureHandler, SceneReceiver, SceneService_SceneMoveListener
|
implements LocationDirector_FailureHandler, SceneReceiver, SceneService_SceneMoveListener,
|
||||||
|
LocationObserver
|
||||||
{
|
{
|
||||||
private static const log :Log = Log.getLog(SceneDirector);
|
private static const log :Log = Log.getLog(SceneDirector);
|
||||||
|
|
||||||
@@ -87,6 +90,9 @@ public class SceneDirector extends BasicDirector
|
|||||||
setSceneRepository(screp);
|
setSceneRepository(screp);
|
||||||
_fact = fact;
|
_fact = fact;
|
||||||
|
|
||||||
|
// we need to observe scene moves so that we can clear out if we change to a non-scene
|
||||||
|
_locdir.addLocationObserver(this);
|
||||||
|
|
||||||
// set ourselves up as a failure handler with the location director because we need to do
|
// set ourselves up as a failure handler with the location director because we need to do
|
||||||
// special processing
|
// special processing
|
||||||
_locdir.setFailureHandler(this);
|
_locdir.setFailureHandler(this);
|
||||||
@@ -320,7 +326,7 @@ public class SceneDirector extends BasicDirector
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// from interface SceneService_SceneMoveListener
|
||||||
public function requestFailed (reason :String) :void
|
public function requestFailed (reason :String) :void
|
||||||
{
|
{
|
||||||
// clear out our pending info
|
// clear out our pending info
|
||||||
@@ -331,6 +337,28 @@ public class SceneDirector extends BasicDirector
|
|||||||
_locdir.failedToMoveTo(sceneId, reason);
|
_locdir.failedToMoveTo(sceneId, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// from interface LocationObserver
|
||||||
|
public function locationMayChange (placeId :int) :Boolean
|
||||||
|
{
|
||||||
|
return true; // fine with us
|
||||||
|
}
|
||||||
|
|
||||||
|
// from interface LocationObserver
|
||||||
|
public function locationDidChange (place :PlaceObject) :void
|
||||||
|
{
|
||||||
|
// if we're no longer in a scene, we need to clear out our scene information
|
||||||
|
if (!(place is SceneObject)) {
|
||||||
|
clearScene();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// from interface LocationObserver
|
||||||
|
public function locationChangeFailed (placeId :int, reason :String) :void
|
||||||
|
{
|
||||||
|
// we don't care about this notification as we're registered as a LocationDirector
|
||||||
|
// FailureHandler so we will later be requested to recover from our failed move
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by SceneController instances to tell us about an update to the current scene.
|
* Called by SceneController instances to tell us about an update to the current scene.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user