When you arrive where you were walking, recenter the view.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@955 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Mike Thomas
2010-08-13 21:15:30 +00:00
parent a1ebef955c
commit 155b0bf2d6
2 changed files with 20 additions and 0 deletions
@@ -138,7 +138,17 @@ public class CharacterIsoSprite extends IsoSprite
public function pathCompleted (timestamp :int) :void public function pathCompleted (timestamp :int) :void
{ {
_character.pathCompleted(timestamp); _character.pathCompleted(timestamp);
var opath :Path = _path;
_path = null; _path = null;
for each (var listener :Function in _pathCompleteListeners) {
listener(this, opath, timestamp);
}
}
public function addPathCompleteListener (listener :Function) :void
{
_pathCompleteListeners.push(listener);
} }
public function move (path :Path) :void public function move (path :Path) :void
@@ -173,5 +183,8 @@ public class CharacterIsoSprite extends IsoSprite
/** The time we started moving on our path. */ /** The time we started moving on our path. */
protected var _pathStamp :int; protected var _pathStamp :int;
/** Anyone who cares when our path finishes. */
protected var _pathCompleteListeners :Array = [];
} }
} }
@@ -490,6 +490,7 @@ public class CrowdStageScenePanel extends StageScenePanel
_objScene.addChild(sprite); _objScene.addChild(sprite);
_sprites.put(info.getBodyOid(), sprite); _sprites.put(info.getBodyOid(), sprite);
sprite.addPathCompleteListener(pathCompleted);
if (sprite.getBodyOid() == myOid()) { if (sprite.getBodyOid() == myOid()) {
_selfSprite = sprite; _selfSprite = sprite;
@@ -655,6 +656,7 @@ public class CrowdStageScenePanel extends StageScenePanel
} finally { } finally {
// keep track of the last time we came to rest // keep track of the last time we came to rest
if (sprite == _selfSprite) { if (sprite == _selfSprite) {
centerView();
_centerStamp = tickStamp; _centerStamp = tickStamp;
} }
} }
@@ -712,6 +714,11 @@ public class CrowdStageScenePanel extends StageScenePanel
} }
} }
protected function pathCompleted (sprite :CharacterIsoSprite, path :Path, when :int) :void
{
handleSpriteArrived(sprite, when);
}
protected var _occupantListener :SetListener = new SetAdapter(null, occupantEntryUpdated, null); protected var _occupantListener :SetListener = new SetAdapter(null, occupantEntryUpdated, null);
protected var _cCtx :CrowdContext; protected var _cCtx :CrowdContext;