private void Vremenska_MouseUp(object sender, MouseEventArgs e) { mouseDown = false; Cursor = Cursors.Default; Obleki.Pogodok(character.Width, character.Height, this.Width, this.Height); if (Obleki.ProveriDaliPobedil()) { Pomoshna pomoshna = new Pomoshna(); pomoshna.smiley = Resources.smiley; pomoshna.text1 = "Браво !!!"; pomoshna.text2 = "Ја завршивте играта"; pomoshna.text3 = "Дали сакате нова игра?"; pomoshna.buttonYes = "Да"; pomoshna.buttonNo = "Не"; if (pomoshna.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DialogResult = DialogResult.OK; this.Close(); } else { DialogResult = DialogResult.Cancel; this.Close(); } } }
// Set the time elapsed label in the form and update the progress bar private void timer1_Tick(object sender, EventArgs e) { timeElapsed++; int min = timeElapsed / 60; int sec = timeElapsed % 60; lblTimer.Text = String.Format("{0:00}:{1:00}", min, sec); pbPogodeni.Value = Convert.ToInt32(tbPogodeniLeft.Text) + Convert.ToInt32(tbPogodeniRight.Text); //If all items in correct lists stop the timer and start a new game with Pomoshna form if (pbPogodeni.Value == pbPogodeni.Maximum) { timer1.Stop(); pomoshna = new Pomoshna(); pomoshna.smiley = Resources.smiley; pomoshna.text1 = "Браво !!!"; pomoshna.text2 = string.Format("Ја завршивте играта за {0:00} минути и {1:00} секунди", min, sec); pomoshna.text3 = "Дали сакате нова игра?"; pomoshna.buttonYes = "Да"; pomoshna.buttonNo = "Не"; if (pomoshna.ShowDialog() == System.Windows.Forms.DialogResult.OK) { newGame(); } else { this.Close(); } } }
private void Ulica_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { person.ChangeDirection(Covece.DIRECTION.UP); person.Move(); } if (e.KeyCode == Keys.Down) { person.ChangeDirection(Covece.DIRECTION.DOWN); person.Move(); } if (e.KeyCode == Keys.Left) { person.ChangeDirection(Covece.DIRECTION.LEFT); person.Move(); } if (e.KeyCode == Keys.Down) { person.ChangeDirection(Covece.DIRECTION.DOWN); person.Move(); } if (e.KeyCode == Keys.Right) { person.ChangeDirection(Covece.DIRECTION.RIGHT); person.Move(); } if (person.Y == 20) { if (lightColor) { Pomoshna pomoshna = new Pomoshna(); pomoshna.text1 = "Браво!!!!!"; pomoshna.text2 = "Успешно поминавте од другата страна на коловозот."; pomoshna.text3 = "Дали сакате да се обидете повторно?"; pomoshna.buttonYes = "Да"; pomoshna.buttonNo = "Не"; pomoshna.smiley = Resources.smiley; if (pomoshna.ShowDialog() == DialogResult.OK) { newGame(); } else { Close(); } } Invalidate(); } }