Example #1
0
 /// <summary>
 /// After an animation is over and after a new animation was selected, this function will play the selected animation.
 /// </summary>
 /// <param name="id">Animation ID to play.</param>
 private void SetNewAnimation(int id)
 {
     if (id < 0)  // no animation found, spawn!
     {
         Play(false);
     }
     else
     {
         iAnimationStep   = -1;
         CurrentAnimation = Animations.GetAnimation(id);
         // Check if animation ID has a child. If so, the child will be created.
         if (Animations.HasAnimationChild(id))
         {
             if (Name != "child")
             {
                 TChild childInfo = Animations.GetAnimationChild(id);
                 Form2  child     = new Form2(Animations, Xml, new Point(Left, Top), !bMoveLeft);
                 for (int i = 0; i < imageList1.Images.Count - 1; i++)
                 {
                     child.addImage(imageList1.Images[i]);
                 }
                 // To detect if it is a child, the name of the form will be renamed.
                 child.Name = "child";
                 child.Show(Width, Height);
                 child.PlayChild(id);
             }
         }
         timer1.Interval = CurrentAnimation.Start.Interval.GetValue();
     }
 }
Example #2
0
 /// <summary>
 /// After an animation is over and after a new animation was selected, this function will play the selected animation.
 /// </summary>
 /// <param name="id">Animation ID to play.</param>
 private void SetNewAnimation(int id)
 {
     if (CurrentAnimation.ID == Animations.AnimationKill)
     {
         return;
     }
     if (id < 0)  // no animation found, spawn!
     {
         Play(false);
     }
     else
     {
         iAnimationStep   = -1;
         CurrentAnimation = Animations.GetAnimation(id);
         // Check if animation ID has a child. If so, the child will be created.
         if (Animations.HasAnimationChild(id))
         {
             // child creating childs... Maximum 5 sub-childs can be created
             if (Name.IndexOf("child") < 0 || int.Parse(Name.Substring(5)) < 5)
             {
                 TChild childInfo = Animations.GetAnimationChild(id);
                 Form2  child     = new Form2(Animations, Xml, new Point(Left, Top), !bMoveLeft);
                 for (int i = 0; i < imageList1.Images.Count; i++)
                 {
                     child.addImage(imageList1.Images[i]);
                 }
                 // To detect if it is a child, the name of the form will be renamed.
                 if (Name.IndexOf("child") < 0) // first child
                 {
                     child.Name = "child1";
                 }
                 else if (Name.IndexOf("child") == 0) // second, fifth child
                 {
                     child.Name = "child" + (int.Parse(Name.Substring(5)) + 1).ToString();
                 }
                 child.Show(Width, Height);
                 child.PlayChild(id);
             }
         }
         timer1.Interval = CurrentAnimation.Start.Interval.GetValue();
     }
 }