Beispiel #1
0
 public void game_over(int wynik)
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = "loose.wav";
     if (muzik == true)
     {
     player.PlayLooping();
     }
     Console.Clear();
     for (int i = 0, j= 0 ; i < 25; i++)
     {
     if (i >= j) Clear_line_of_numbers(i - j, 7); if (j<6) j++;
     if (i > 3) { Console.SetCursorPosition(75, i - 4); Console.Write("  ____                         ___                 "); }
     if (i > 2) { Console.SetCursorPosition(75, i - 3); Console.Write(" / ___| __ _ _ __ ___   ___   / _ \\__   _____ _ __ "); }
     if (i > 1) { Console.SetCursorPosition(75, i - 2); Console.Write("| |  _ / _` | '_ ` _ \\ / _ \\ | | | \\ \\ / / _ \\ '__|"); }
     if (i > 0) { Console.SetCursorPosition(75, i - 1); Console.Write("| |_| | (_| | | | | | |  __/ | |_| |\\ V /  __/ |   ");}
     if (i > -1) {Console.SetCursorPosition(75, i);    Console.Write(" \\____|\\__,_|_| |_| |_|\\___|  \\___/  \\_/ \\___|_|   ");}
     Thread.Sleep(60);
     }
     Console.ForegroundColor = ConsoleColor.DarkGray;
     int hoffset = 78;
     int voffset = 30;
     Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╔══════════════════════════════════════════╗"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╠─────────────Podaj swoje imię─────────────╣"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╠══════════════════════════════════════════╣"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("║                                          ║"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╠══════════════════════════════════════════╣"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╠───────────────Twój wynik to──────────────╣"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("║                                          ║"); Console.SetCursorPosition(hoffset, voffset++);
     Console.WriteLine("╚══════════════════════════════════════════╝"); Console.SetCursorPosition(hoffset + 20, 36);
     Console.Write(wynik);
     Console.SetCursorPosition(hoffset+2, 33);
     Console.ForegroundColor = ConsoleColor.White;
     Console.CursorVisible=true;
     string name = Console.ReadLine();
     Console.CursorVisible = false;
     Scoreboard scoreboard = new Scoreboard();
     if (name != "")
     {
     Player winner = new Player();
     winner.name = name;
     winner.score = wynik;
     scoreboard.dodaj(winner);
     }
     Thread.Sleep(500);
     player.Stop();
     scoreboard.muzik = this.muzik;
     scoreboard.wypisz(muzik);
 }
Beispiel #2
0
 /// <summary>
 /// wczytaj - dodaje zwyciezcow z pliku do lisy
 /// </summary>
 public void wczytaj()
 {
     if (File.Exists(path))
     {
         using (StreamReader personfile = new StreamReader(path))
         {
             string line;
             while ((line = personfile.ReadLine()) != null)
             {
                 Player p = new Player();
                 string[] lineSplitted = line.Split(',');
                 p.name = lineSplitted[0];
                 p.score = int.Parse(lineSplitted[1]);
                 listPlayer.Add(p);
             }
             personfile.Close();
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// dodaj - dodaje pojedyńczygo gracza do listy
 /// </summary>
 public void dodaj(Player player)
 {
     listPlayer.Add(player);
 }