コード例 #1
0
        private void Mine_Clicked_State(object sender, EventArgs e)
        //game over when you hit 3 "mines" (coal rock things)
        {
            var button = (sender as Button);

            mine_count--;
            if (button != null)
            {
                SoundPlayer boom = new SoundPlayer(boom_soundPath);
                boom.Play();
                scoreandlives.Text = "lives: " + mine_count.ToString() + " score: " + goldcount.ToString();
                if (mine_count != 0)
                {
                    button.Content = new Image
                    {
                        Source  = new BitmapImage(new Uri(boomPath)),
                        Stretch = Stretch.UniformToFill
                    };
                }
                else
                {
                    timer.Stop();
                    Game_Over_Window gameOver = new Game_Over_Window();
                    gameOver.Show();
                    this.Close();
                }
            }
        }
コード例 #2
0
 private void timerCount(object sender, EventArgs e)
 {
     if (time_left > 0)
     {
         time_left--;
         countdown.Text = time_left.ToString() + "s";
     }
     else
     {
         timer.Stop();
         Game_Over_Window gameOver = new Game_Over_Window();
         gameOver.Show();
         this.Close();
     }
 }