/// <summary>Changes the framerate of this animation.</summary> public void ChangeFrameRate(int newRate) { FrameRate = newRate; // For each actively running animation.. if (FirstInstance != null) { // What's the delay in seconds of a frame? float newDelay = 1f / (float)FrameRate; // For each.. SPAInstance current = FirstInstance; while (current != null) { if (current.Animation == this) { current.FrameDelay = newDelay; } // Hop to the next one: current = current.InstanceAfter; } } }
public override void GoingOnDisplay(){ if(Animation==null && SPAFile!=null){ Animation=SPAFile.GetInstance(); } }
/// <summary>Called when this image is going to be displayed.</summary> public void GoingOnDisplay() { if (Animated && Animation == null && SPAFile != null) { Animation = SPAFile.GetInstance(); } }
public override void GoingOffDisplay(){ if(Animation!=null){ Animation.Stop(); Animation=null; } }
/// <summary>Called when this image is no longer being displayed.</summary> public void GoingOffDisplay() { if (Animated && Animation != null) { Animation.Stop(); Animation = null; } }
public override void GoingOffDisplay() { if (Animation != null) { Animation.Stop(); Animation = null; } }
/// <summary>Gets how many animations are actively playing.</summary> /// <returns>The number of animations currently playing.</returns> public static int ActiveCount() { int count = 0; SPAInstance current = FirstInstance; while (current != null) { count++; current = current.InstanceAfter; } return(count); }
/// <summary>Advances playback of any running animations and performs some garbage collection. /// Called by <see cref="UI.Update"/>.</summary> public static void Update() { // Advance any active animations. // These are all animations in our Instance chain. if (FirstInstance != null) { SPAInstance current = FirstInstance; while (current != null) { current.Update(); current = current.InstanceAfter; } } }
/// <summary>Creates a playable instance of this animation. /// Instances are required as the same animation could be visible multiple times.</summary> /// <returns>A playable form of this animation.</returns> public SPAInstance GetInstance() { // Create the instance: SPAInstance instance = new SPAInstance(this); // Push the instance to the global animate queue. if (FirstInstance == null) { FirstInstance = LastInstance = instance; } else { instance.InstanceBefore = LastInstance; LastInstance = LastInstance.InstanceAfter = instance; } return(instance); }
/// <summary>Clears all active SPA animations.</summary> public static void Clear() { LastInstance = FirstInstance = null; }
/// <summary>Called when this image is no longer being displayed.</summary> public void GoingOffDisplay(){ if(Animated&&Animation!=null){ Animation.Stop(); Animation=null; } }
//--------------------------------------