示例#1
0
 private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
 {
     if (Functie._mutaPiesa == null)
     {
         return;
     }
     if (Functie._mutaPiesa.piesaAproape())
     {
         Functie._piese.Remove(Functie._mutaPiesa);
         Functie._piese.Reverse();
         Functie._piese.Add(Functie._mutaPiesa);
         Functie._piese.Reverse();
         Functie._gameOver = true;
         foreach (var piesa in Functie._piese)
         {
             if (piesa.piesaAcasa())
             {
                 continue;
             }
             Functie._gameOver = false;
             break;
         }
     }
     Functie._mutaPiesa = null;
     Functie.MakeBackground(pictureBox1);
     Functie.DrawBoard(pictureBox1);
     if (Functie._gameOver == true)
     {
         MessageBox.Show("Felicitari ai reusit sa pui toate piesele la loc!");
     }
 }
示例#2
0
 private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     Functie._mutaPiesa = null;
     foreach (var piesa in Functie._piese)
     {
         if (!piesa.piesaAcasa() && piesa.Contains(e.Location))
         {
             Functie._mutaPiesa = piesa;
         }
     }
     if (Functie._mutaPiesa == null)
     {
         return;
     }
     Functie._mutaPunct = e.Location;
     Functie._piese.Remove(Functie._mutaPiesa);
     Functie._piese.Add(Functie._mutaPiesa);
     Functie.MakeBackground(pictureBox1);
 }