Esempio n. 1
0
        private void gameTime_Tick(object sender, EventArgs e)
        {
            if (playTime > 0)
            {
                playTime--;
                gameCountDownBeforeStart.Text = playTime.ToString();

                if (imagineaButonului1.IsEnabled == false && imagineaButonului2.IsEnabled == false && imagineaButonului3.IsEnabled == false && imagineaButonului4.IsEnabled == false &&
                    imagineaButonului5.IsEnabled == false && imagineaButonului6.IsEnabled == false && imagineaButonului7.IsEnabled == false && imagineaButonului8.IsEnabled == false &&
                    imagineaButonului9.IsEnabled == false && imagineaButonului10.IsEnabled == false && imagineaButonului11.IsEnabled == false && imagineaButonului12.IsEnabled == false &&
                    imagineaButonului13.IsEnabled == false && imagineaButonului14.IsEnabled == false && imagineaButonului15.IsEnabled == false && imagineaButonului16.IsEnabled == false)
                {
                    gameTime.Stop();

                    System.IO.Stream         gameWinStream = Properties.Resources.gameWin;
                    System.Media.SoundPlayer gameWinPlayer = new System.Media.SoundPlayer(gameWinStream);
                    gameWinPlayer.Play();
                    GameWin main = new GameWin();
                    App.Current.MainWindow = main;
                    main.Show();
                }
                else if (playTime == 0)
                {
                    imagineaButonului1.IsEnabled    = false;
                    imagineaButonului2.IsEnabled    = false;
                    imagineaButonului3.IsEnabled    = false;
                    imagineaButonului4.IsEnabled    = false;
                    imagineaButonului5.IsEnabled    = false;
                    imagineaButonului6.IsEnabled    = false;
                    imagineaButonului7.IsEnabled    = false;
                    imagineaButonului8.IsEnabled    = false;
                    imagineaButonului9.IsEnabled    = false;
                    imagineaButonului10.IsEnabled   = false;
                    imagineaButonului11.IsEnabled   = false;
                    imagineaButonului12.IsEnabled   = false;
                    imagineaButonului13.IsEnabled   = false;
                    imagineaButonului14.IsEnabled   = false;
                    imagineaButonului15.IsEnabled   = false;
                    imagineaButonului16.IsEnabled   = false;
                    gameCountDownBeforeStart.Text   = "";
                    gameCountDownPlay.TextAlignment = TextAlignment.Center;
                    gameCountDownPlay.Foreground    = new SolidColorBrush(Colors.Red);


                    GameOver main = new GameOver();
                    App.Current.MainWindow = main;
                    main.Show();

                    System.IO.Stream         gameOverStream = Properties.Resources.gameOver;
                    System.Media.SoundPlayer gameOverPlayer = new System.Media.SoundPlayer(gameOverStream);
                    gameOverPlayer.Play();
                }
            }
            // throw new NotImplementedException();
        }
Esempio n. 2
0
        public void gameTime_Tick(object sender, EventArgs e)
        {
            if (playTime > 0)
            {
                playTime--;
                gameCountDownBeforeStart.Text = playTime.ToString();

                if (btnImage1.IsEnabled == false && btnImage2.IsEnabled == false && btnImage3.IsEnabled == false && btnImage4.IsEnabled == false &&
                    btnImage5.IsEnabled == false && btnImage6.IsEnabled == false && btnImage7.IsEnabled == false && btnImage8.IsEnabled == false &&
                    btnImage9.IsEnabled == false && btnImage10.IsEnabled == false && btnImage11.IsEnabled == false && btnImage12.IsEnabled == false &&
                    btnImage13.IsEnabled == false && btnImage14.IsEnabled == false && btnImage15.IsEnabled == false && btnImage16.IsEnabled == false &&
                    btnImage17.IsEnabled == false && btnImage18.IsEnabled == false && btnImage19.IsEnabled == false && btnImage20.IsEnabled == false &&
                    btnImage21.IsEnabled == false && btnImage22.IsEnabled == false && btnImage23.IsEnabled == false && btnImage24.IsEnabled == false)
                {
                    gameTime.Stop();

                    System.IO.Stream         gameWinStream = Properties.Resources.gameWin;
                    System.Media.SoundPlayer gameWinPlayer = new System.Media.SoundPlayer(gameWinStream);
                    gameWinPlayer.Play();
                    GameWin main = new GameWin();
                    App.Current.MainWindow = main;
                    main.Show();
                }
                else if (playTime == 0)
                {
                    btnImage1.IsEnabled             = false;
                    btnImage2.IsEnabled             = false;
                    btnImage3.IsEnabled             = false;
                    btnImage4.IsEnabled             = false;
                    btnImage5.IsEnabled             = false;
                    btnImage6.IsEnabled             = false;
                    btnImage8.IsEnabled             = false;
                    btnImage9.IsEnabled             = false;
                    btnImage10.IsEnabled            = false;
                    btnImage11.IsEnabled            = false;
                    btnImage12.IsEnabled            = false;
                    btnImage13.IsEnabled            = false;
                    btnImage14.IsEnabled            = false;
                    btnImage15.IsEnabled            = false;
                    btnImage16.IsEnabled            = false;
                    btnImage17.IsEnabled            = false;
                    btnImage18.IsEnabled            = false;
                    btnImage19.IsEnabled            = false;
                    btnImage20.IsEnabled            = false;
                    btnImage21.IsEnabled            = false;
                    btnImage22.IsEnabled            = false;
                    btnImage23.IsEnabled            = false;
                    btnImage24.IsEnabled            = false;
                    gameCountDownBeforeStart.Text   = "";
                    gameCountDownPlay.TextAlignment = TextAlignment.Center;
                    gameCountDownPlay.Foreground    = new SolidColorBrush(Colors.Red);
                    gameCountDownPlay.Text          = "Joc terminat";

                    GameOver main = new GameOver();
                    App.Current.MainWindow = main;
                    main.Show();

                    System.IO.Stream         gameOverStream = Properties.Resources.gameOver;
                    System.Media.SoundPlayer gameOverPlayer = new System.Media.SoundPlayer(gameOverStream);
                    gameOverPlayer.Play();
                }
            }
        }