コード例 #1
0
 /// <summary>
 /// Creates new statistics panel for given statistics
 /// </summary>
 /// <param name="gameStats">GameStatistics</param>
 public StatisticsPanel(GameStatistics gameStats)
 {
     this._stats = gameStats;
     InitializeComponents();
 }
コード例 #2
0
        /// <summary>
        /// Event handler for GameWindws close event
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="gameStatistics">Game statistics</param>
        private void GameWindow_OnGameOver(object sender, GameStatistics gameStatistics)
        {
            ScoreRecord scoreRecord = new ScoreRecord();
            scoreRecord.Score = gameStatistics.Score;

            // Add score into HighScore table
            int scoreIndex = parentApp.HighScore.AddRecord(scoreRecord);

            // Show high score window
            HighScoreWindow scoreWindow = new HighScoreWindow(parentApp);

            // if high score has been reached then edit name
            if (scoreIndex > -1)
                scoreWindow.EditItem(scoreIndex);
        }