Added support for letting a media know when it's about to be ticked for

the first time. This is the only indication that things are really
underway and it's a fine time to do things like play sounds that are
synchronized with that media and do other fun stuff.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3084 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-08-18 01:33:32 +00:00
parent 63fad5a1e6
commit d17e58a924
9 changed files with 117 additions and 40 deletions
@@ -1,10 +1,8 @@
//
// $Id: AnimationManager.java,v 1.17 2004/02/25 14:43:17 mdb Exp $
// $Id: AnimationManager.java,v 1.18 2004/08/18 01:33:32 mdb Exp $
package com.threerings.media.animation;
import com.samskivert.util.ObserverList;
import com.threerings.media.AbstractMediaManager;
import com.threerings.media.RegionManager;
@@ -56,27 +54,10 @@ public class AnimationManager extends AbstractMediaManager
}
// as the anim is finished, remove it and notify observers
anim.queueNotification(new AnimCompletedOp(anim, tickStamp));
anim.willFinish(tickStamp);
unregisterAnimation(anim);
anim.didFinish();
anim.didFinish(tickStamp);
// Log.info("Removed finished animation " + anim + ".");
}
}
/** Used to dispatch {@link AnimationObserver#animationCompleted}. */
protected static class AnimCompletedOp implements ObserverList.ObserverOp
{
public AnimCompletedOp (Animation anim, long when) {
_anim = anim;
_when = when;
}
public boolean apply (Object observer) {
((AnimationObserver)observer).animationCompleted(_anim, _when);
return true;
}
protected Animation _anim;
protected long _when;
}
}