Пример #1
0
        /// <summary>
        /// Load all the highscore lists.
        /// </summary>
        public void CreateHighscoreLists()
        {
            mHighscores = new HighscoreList[3, 7];

            for (int diff = 0; diff < mHighscores.GetLength(0); ++diff)
            {
                for (int lvl = 0; lvl < mHighscores.GetLength(1); ++lvl)
                {
                    mHighscores[diff, lvl] = new HighscoreList((Difficulty)diff, (Level)lvl);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Set info for the end screen.
        /// </summary>
        /// <param name="difficulty">The difficulty played.</param>
        /// <param name="level">The level played.</param>
        /// <param name="score">The score achieved.</param>
        /// <param name="gameWasWon">Whether the game was won.</param>
        public void SetInfo(Difficulty difficulty, Level level, int score, bool gameWasWon)
        {
            // Make mouse visible.
            Core.IsMouseVisible = true;

            // Save information.
            mGameWasWon = gameWasWon;
            mDifficulty = difficulty;
            mLevel      = level;

            // Set up winning presentation text.
            if (mGameWasWon)
            {
                mWinningColour    = Color.Gold;
                mWinningText.Text = "YOU WON!!!";
            }
            else
            {
                mWinningColour    = Color.Red;
                mWinningText.Text = "YOU LOST";
            }

            Vector2 textSize = mTextFont.MeasureString(mWinningText.Text);

            mWinningText.DrawPos = new Vector2((mBoardPos.X - textSize.X) * 0.5f,
                                               mScorePresText.DrawPos.Y - 32 - textSize.Y);

            // Set up score presentation text.
            mScoreText.Text    = score.ToString();
            textSize           = mTextFont.MeasureString(mScoreText.Text) * mScorePresScale;
            mScoreText.DrawPos = new Vector2((mBoardPos.X - textSize.X) * 0.5f,
                                             mScorePresText.DrawPos.Y + textSize.Y - 12);

            // Set up sign text.
            mSignText.Text    = mDifficulty.ToString() + ": " + mLevel.ToString();
            textSize          = mSignFont.MeasureString(mSignText.Text);
            mSignText.DrawPos = new Vector2(mSignPos.X + (mSignPos.Width - textSize.X) * 0.5f,
                                            mSignPos.Y + (mSignPos.Height - textSize.Y) * 0.5f);

            // Load high score and save it to file.
            mHighscores = new HighscoreList(mDifficulty, mLevel, gameWasWon ? score : -1);
            mHighscores.SaveToFile();
        }