Esempio n. 1
0
 private void PositionnePlateau()
 {
   if (Jeu == null)
   {
     return;
   }
   float k = 1;
   if (Image != null)
   {
     k = (float)Image.Height / Image.Width;
   }
   Size szPlateau = new Size(Width, (int)(k * Width));
   if (szPlateau.Height > Height)
   {
     szPlateau = new Size((int)(Width / k), Height);
   }
   Point locationPlateau = new Point((Width - szPlateau.Width) / 2, (Height - szPlateau.Height) / 2);
   PbPlateau.Bounds = new Rectangle(locationPlateau, szPlateau);
   PbPlateau.Show();
 }
Esempio n. 2
0
 private void DoAnimation()
 {
   TimerAnimation.Stop();
   Etape++;
   if (Etape > NbEtapes)
   {
     if (ResolutionAutomatiqueEnCours)
     {
       Trace("ResolutionAutomatiqueAvancePosition");
       int posVide = Jeu.ResolutionAutomatiqueAvancePosition();
       if (Jeu.ResolutionAutomatiqueIsResolu())
       {
         AnimationEnCours = false;
         ResolutionAutomatiqueEnCours = false;
         ResolutionAutomatiqueOver?.Invoke(this, EventArgs.Empty);
         PbPlateau.Refresh();
         return;
       }
       DeltaDrawAnimation = ResoudreAutomatiquementCalculeDeltaDrawAnimation();
       Etape = 0;
     }
     else
     {
       int posVide = Jeu.PositionPiece(Jeu.CaseVide);
       posVide += DeltaAnimation;
       Jeu.SwitchVide(posVide);
       if (posVide == PosDestination)
       {
         AnimationEnCours = false;
         PbPlateau.Refresh();
         return;
       }
       Etape = 0;
       PosPieceAnimation = posVide + DeltaAnimation;
     }
   }
   PbPlateau.Refresh();
   TimerAnimation.Start();
 }
Esempio n. 3
0
 public void ChangeImage(Image image)
 {
   Image = image;
   PbPlateau.Refresh();
 }