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!"); } }
private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (Functie._mutaPiesa == null) { return; } int dx = e.X - Functie._mutaPunct.X; int dy = e.Y - Functie._mutaPunct.Y; Functie._mutaPiesa._locatieCurenta.X += dx; Functie._mutaPiesa._locatieCurenta.Y += dy; Functie._mutaPunct = e.Location; Functie.DrawBoard(pictureBox1); }