示例#1
0
        // ADD THE CURRENT SCORE TO TOP SCORES \\
        private void AddNewScore()
        {
            TopScore currentScore = new TopScore(score, "anonymous");

            HighScore highScr = new HighScore(currentScore);

            highScr.ShowDialog();
        }
示例#2
0
        // ADDS TOP SCORE TO LIST, OPENS THE HIGHEST SCORES WINDOW \\
        private void HighScore_FormClosed(object sender, FormClosedEventArgs e)
        {
            // REMOVES LOWEST SCORE IF NECESSARY \\
            if (TopScore.topScores.Count >= Form1.MAX_TOP_SCORES)
            {
                int      lowest      = TopScore.topScores.Min(i => i.Score);
                TopScore lowestScore = TopScore.topScores.Find(i => i.Score == lowest);
                TopScore.topScores.Remove(lowestScore);
            }

            // ADDS NEW HIGH SCORE \\
            TopScore.topScores.Add(Current);
            HighestScores highestscrs = new HighestScores();

            highestscrs.ShowDialog();
        }
示例#3
0
        // READS IN THE TOP SCORES FROM FILE \\
        private void ReadTopScores()
        {
            try
            {
                if (File.Exists(SCORE_FILE))
                {
                    using (StreamReader read = new StreamReader(SCORE_FILE))
                    {
                        while (!read.EndOfStream)
                        {
                            string[] scoreInfo = read.ReadLine().Split('|');
                            TopScore current   = new TopScore(int.Parse(scoreInfo[SCORE]), scoreInfo[NAME]);

                            TopScore.topScores.Add(current);
                        }
                    }
                }
            } catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
示例#4
0
 public HighScore(TopScore _ts)
 {
     InitializeComponent();
     Current = _ts;
 }