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:
@@ -138,7 +138,17 @@ public class CharacterIsoSprite extends IsoSprite
|
||||
public function pathCompleted (timestamp :int) :void
|
||||
{
|
||||
_character.pathCompleted(timestamp);
|
||||
var opath :Path = _path;
|
||||
_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
|
||||
@@ -173,5 +183,8 @@ public class CharacterIsoSprite extends IsoSprite
|
||||
|
||||
/** The time we started moving on our path. */
|
||||
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);
|
||||
_sprites.put(info.getBodyOid(), sprite);
|
||||
sprite.addPathCompleteListener(pathCompleted);
|
||||
|
||||
if (sprite.getBodyOid() == myOid()) {
|
||||
_selfSprite = sprite;
|
||||
@@ -655,6 +656,7 @@ public class CrowdStageScenePanel extends StageScenePanel
|
||||
} finally {
|
||||
// keep track of the last time we came to rest
|
||||
if (sprite == _selfSprite) {
|
||||
centerView();
|
||||
_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 _cCtx :CrowdContext;
|
||||
|
||||
Reference in New Issue
Block a user