Exemple #1
0
 public void GameOver()
 {
     timer1.Stop();
     exitGameBtn = false;
     mainSound.Stop();
     gameOverS.Play();
     EndGame form = new EndGame();
     form.ShowDialog();
     player = new Player(form.NameP, ballCollection.Score);
     playersScore.Add(player);
     writeFile();
     if (form.End == 0)
     {
         newGame();
         sw.Flush();
     }
     else if (form.End == 1)
     {
         this.Close();
         sw.Close();
     }
 }
Exemple #2
0
 public FallScores()
 {
     InitializeComponent();
     String filePath = System.IO.Path.GetFullPath("FlappyScore.txt");
     StreamReader sr = new StreamReader(filePath);
     String s = "";
     while ((s = sr.ReadLine()) != null)
     {
         string[] strings = { " ", "0" };
         Player p = new Player(strings[0], int.Parse(strings[1]));
         if (s.Contains(','))
         {
             strings = s.Split(',');
         }
         if (strings.Count() == 2)
         {
             p = new Player(strings[0], int.Parse(strings[1]));
         }
         lstScores.Items.Add(p);
         lstScores.Items.Add("");
     }
     sr.Close();
 }
Exemple #3
0
        public void endGame()
        {
            exitGameBtn = false;
            timer1.Stop();
            mainSound.Stop();
            EndGame form = new EndGame();
            form.ShowDialog();
            player = new Player(form.NameP, Score);
            playersScore.Add(player);
            writeFile();
            if (form.End == 0)
            {
                Score = 0;
                runGame();

            }
            else if (form.End == 1)
            {
                this.Close();
                sw.Close();
            }
        }