コード例 #1
0
ファイル: FormPoo.cs プロジェクト: elkoniu/scmpoo
 protected override void OnMouseDown(MouseEventArgs e)
 {
     mouseDownPoint = e.Location;
     IsMouseDown = true;
     if (CurrentAnimation == null || !(CurrentAnimation is Falling))
     {
         CurrentAnimation = new Falling(this);
     }
 }
コード例 #2
0
ファイル: FormPoo.cs プロジェクト: elkoniu/scmpoo
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (CurrentAnimation == null)
     {
         CurrentAnimation = new Falling(this);
     }
     if (CurrentAnimation.Finished)
     {
         var animations = Assembly.GetExecutingAssembly().GetTypes().Where(t => string.Equals(t.Namespace, "scmpoo.animations.random"));
         var anim = animations.ElementAt(FormMain.RandomInst.Next(0, animations.Count()));
         CurrentAnimation = Activator.CreateInstance(anim, this) as Animation;
     }
     if (!CurrentAnimation.Started)
     {
         CurrentAnimation.Start();
         CurrentAnimation.Started = true;
     }
     int interval = CurrentAnimation.Tick();
     timer1.Interval = interval;
 }