private void bNew_Click(object sender, EventArgs e) { Animation animation = new Animation(0.2f); animation.Name = "Unnamed"; for (int i = 0; i < 4; i++) { animation.Indices.Add(0); } this.Animations.Add(animation); cbAnimations.Items.Add(animation.Name); cbAnimations.SelectedIndex = cbAnimations.Items.Count - 1; tbCurrentFrame.Maximum = 4 - 1; this.SetState(true); }
public void Play(Animation animation, bool forcePlayOnce, Action callback) { if (!forcePlay) { this.Reset(); this.forcePlay = forcePlayOnce; this.callback = callback; if (animation != null && (this.controller == null || this.controller.Animation != animation)) { if (controller != null) controller.FocusLost(); this.controller = new AnimationController(animation); if (!this.cachedAnimations.ContainsKey(animation) || animation.Resettable) { } else { this.controller = this.cachedAnimations[animation]; } if (!this.cachedAnimations.ContainsKey(animation)) { this.cachedAnimations.Add(animation, this.controller); } this.controller.LoopPassed += new EventHandler(onLoopPassed); } } }
public AnimationController(Animation animation) { this.Animation = animation; }