private void IsGameOver_Tick(object sender, EventArgs e) { if (Game.GameOver() == true) { IsGameOver.Stop(); const string message = "Вы проиграли. Хотите начать заново?"; const string caption = "Сообщение"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { Game.Refresh(); PaintGame(Game.GetAll()); AddGun(Game.GetFishinGun(), getColumn); label1.Text = Convert.ToString("Счёт: " + Game.GetScore()); IsGameOver.Start(); } else { this.MouseClick -= GameForm_MouseClick; IsGameOver.Stop(); AddFishTimer.Stop(); AddTimer.Stop(); stop = true; } } }
private void pictureBox1_Click(object sender, EventArgs e) { if (stop == true) { this.MouseClick += GameForm_MouseClick; IsGameOver.Start(); AddFishTimer.Start(); AddTimer.Start(); stop = false; } Game.Refresh(); PaintGame(Game.GetAll()); AddGun(Game.GetFishinGun(), getColumn); label1.Text = Convert.ToString("Счёт: " + Game.GetScore()); }
public GameForm() { InitializeComponent(); fishesRes[0] = small; fishesRes[1] = medium; fishesRes[2] = big; fishesRes[3] = danger; fishesRes_r[0] = small; fishesRes_r[1] = medium_r; fishesRes_r[2] = big_r; CreateTable(); pictureBox1.Cursor = Cursors.Hand; Game.Start(); PaintGame(Game.GetAll()); label1.Text = Convert.ToString("Счёт: " + 0); IsGameOver.Start(); AddFishTimer.Start(); AddTimer.Start(); stop = false; }