コード例 #1
0
ファイル: SinglePlayer.cs プロジェクト: Hugo-Persson/Tetris
        private void GameOver()
        {
            player.Stop();
            //I check if the timer is enabled because I don't want the program to run the code twice which can happen if the timer interval is small enough

            if (Timer.Enabled)
            {
                Timer.Enabled = false;

                HighScores highScores;
                LoadHighScores(out highScores);

                //I test for 10 because it means that it is not a new highscore
                if (highScores.CheckForNewHighScore(Shapes.score) == 10)
                {
                    GameOver gameOver = new GameOver();
                    Hide();
                    gameOver.Show();
                }
                else if (highScores.CheckForNewHighScore(Shapes.score) <= 4)
                {
                    NewHighScore newHighScore = new NewHighScore();
                    Hide();
                    newHighScore.Show();
                }
                else
                {
                    MessageBox.Show("CheckForNewHighScore error");
                }
            }
        }
コード例 #2
0
ファイル: Multiplayer.cs プロジェクト: Hugo-Persson/Tetris
        private void GameOver()
        {
            player.Stop();
            if (Timer.Enabled)
            {
                Timer.Enabled = false;

                HighScores highScores;
                LoadHighScores(out highScores);

                //Jag testar för 10 för det betyder att scoret inte är större än något highscore
                if (highScores.CheckForNewHighScore(Shapes.score) == 10)
                {
                    GameOver gameOver = new GameOver();
                    Hide();
                    gameOver.Show();
                }
                else if (highScores.CheckForNewHighScore(Shapes.score) <= 4)
                {
                    NewHighScore newHighScore = new NewHighScore();
                    Hide();
                    newHighScore.Show();
                }
                else
                {
                    MessageBox.Show("CheckForNewHighScore error");
                }
            }
        }