From 1a79a676ab31648d89731eb09e4853a7a846628f Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sat, 18 Sep 2004 22:56:35 +0000 Subject: [PATCH] The default implementation works with an animation manager which is what we want to do most of the time anyway (in cases where we don't care about whether an animation is "interesting" with regard to puzzle action). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3121 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../media/animation/AnimationSequencer.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/java/com/threerings/media/animation/AnimationSequencer.java b/src/java/com/threerings/media/animation/AnimationSequencer.java index 44966e150..2142aca97 100644 --- a/src/java/com/threerings/media/animation/AnimationSequencer.java +++ b/src/java/com/threerings/media/animation/AnimationSequencer.java @@ -1,5 +1,5 @@ // -// $Id: AnimationSequencer.java,v 1.15 2004/08/27 02:12:38 mdb Exp $ +// $Id: AnimationSequencer.java,v 1.16 2004/09/18 22:56:35 mdb Exp $ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -37,16 +37,20 @@ import com.threerings.media.Log; * are also provided for running code upon the completion of animations in * the sequence. */ -public abstract class AnimationSequencer extends Animation +public class AnimationSequencer extends Animation { /** * Constructs an animation sequencer with the expectation that * animations will be added via subsequent calls to {@link * #addAnimation}. + * + * @param animmgr the animation manager to which to add our animations + * when they are ready to start. */ - public AnimationSequencer () + public AnimationSequencer (AnimationManager animmgr) { super(new Rectangle()); + _animmgr = animmgr; } /** @@ -158,14 +162,18 @@ public abstract class AnimationSequencer extends Animation /** * Called when the time comes to start an animation. Derived classes - * must implement this method and pass the animation on to their + * may override this method and pass the animation on to their * animation manager and do whatever else they need to do with - * operating animations. + * operating animations. The default implementation simply adds them + * to the media panel supplied when we were constructed. * * @param anim the animation to be displayed. * @param tickStamp the timestamp at which this animation was fired. */ - protected abstract void startAnimation (Animation anim, long tickStamp); + protected void startAnimation (Animation anim, long tickStamp) + { + _animmgr.registerAnimation(anim); + } protected class AnimRecord extends AnimationAdapter { @@ -253,6 +261,9 @@ public abstract class AnimationSequencer extends Animation protected AnimRecord _trigger; } + /** The animation manager in which we run animations. */ + protected AnimationManager _animmgr; + /** Animations that have not been fired. */ protected ArrayList _queued = new ArrayList();