Exemple #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);
 }
Exemple #2
0
        public void menu_conroler(bool play)
        {
            if (play == true && muzik == true)
            {
                player.SoundLocation = "1.wav";
                player.Play();
            }
            Scoreboard scoreboard = new Scoreboard();

            while (true)
            {
                ConsoleKeyInfo kb;
                kb = Console.ReadKey(false);
                switch (kb.Key)
                {     //react to input
                case ConsoleKey.UpArrow:
                    switch (menu_state)
                    {
                    case 0:
                        highlight_menu(3, muzik);
                        menu_state = ((4 + menu_state - 1) % 4);
                        break;

                    case 1:
                        highlight_menu(0, muzik);
                        menu_state = ((4 + menu_state - 1) % 4);
                        break;

                    case 2:
                        highlight_menu(1, muzik);
                        menu_state = ((4 + menu_state - 1) % 4);
                        break;

                    case 3:
                        highlight_menu(2, muzik);
                        menu_state = ((4 + menu_state - 1) % 4);
                        break;
                    }
                    break;

                case ConsoleKey.DownArrow:

                    switch (menu_state)
                    {
                    case 0:
                        highlight_menu(1, muzik);
                        menu_state = ((menu_state + 1) % 4);
                        break;

                    case 1:
                        highlight_menu(2, muzik);
                        menu_state = ((menu_state + 1) % 4);
                        break;

                    case 2:
                        highlight_menu(3, muzik);
                        menu_state = ((menu_state + 1) % 4);
                        break;

                    case 3:
                        highlight_menu(0, muzik);
                        menu_state = ((menu_state + 1) % 4);
                        break;
                    }
                    break;

                case ConsoleKey.Enter:
                    switch (menu_state)
                    {
                    case 0:
                        Console.Clear();
                        menu_LVL();
                        break;

                    case 1:
                        if ((kb.Key == ConsoleKey.Enter) && (muzik == false))
                        {
                            player.SoundLocation = "1.wav";
                            player.Play();
                            player.Play();
                            muzik = true;            // wlacz wlacz dzwieki + zmiana stanu DODAC FUNKCJE WYLACZENIA DZWIEKOW
                            Console.Clear();
                            highlight_menu(1, muzik);
                        }
                        else if ((kb.Key == ConsoleKey.Enter) && (muzik == true))
                        {
                            player.Stop();
                            muzik = false;            // wylacz wlacz dzwieki + zmiana stanu
                            ClearCurrentConsoleLine(20);
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.SetCursorPosition(0, 20);
                            Console.Write(music_OFF);
                        }
                        break;

                    case 2:
                        scoreboard.muzik = this.muzik;
                        scoreboard.wypisz(false);
                        break;

                    case 3:
                        Environment.Exit(0);
                        break;
                    }
                    break;

                case ConsoleKey.Escape:
                    Environment.Exit(0);
                    break;
                }
            }
        }
Exemple #3
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);
        }
Exemple #4
0
        public void menu_conroler(bool play)
        {
            if (play == true && muzik==true)
            {
                player.SoundLocation = "1.wav";
                player.Play();
            }
            Scoreboard scoreboard = new Scoreboard();
            while (true)
            {
                ConsoleKeyInfo kb;
                    kb = Console.ReadKey(false);
                    switch (kb.Key)
                    { //react to input
                        case ConsoleKey.UpArrow:
                            switch (menu_state)
                            {
                                case 0:
                                    highlight_menu(3,muzik);
                                    menu_state = ((4 + menu_state - 1) % 4);
                                    break;
                                case 1:
                                    highlight_menu(0, muzik);
                                    menu_state = ((4 + menu_state - 1) % 4);
                                    break;
                                case 2:
                                    highlight_menu(1, muzik);
                                    menu_state = ((4 + menu_state - 1) % 4);
                                    break;
                                case 3:
                                    highlight_menu(2, muzik);
                                    menu_state = ((4 + menu_state - 1) % 4);
                                    break;
                            }
                            break;

                        case ConsoleKey.DownArrow:

                            switch (menu_state)
                            {
                                case 0:
                                    highlight_menu(1, muzik);
                                    menu_state = ((menu_state + 1) % 4);
                                    break;
                                case 1:
                                    highlight_menu(2, muzik);
                                    menu_state = ((menu_state + 1) % 4);
                                    break;
                                case 2:
                                    highlight_menu(3, muzik);
                                    menu_state = ((menu_state + 1) % 4);
                                    break;
                                case 3:
                                    highlight_menu(0, muzik);
                                    menu_state = ((menu_state + 1) % 4);
                                    break;
                            }
                            break;
                        case ConsoleKey.Enter:
                            switch (menu_state)
                            {
                                case 0:
                                    Console.Clear();
                                    menu_LVL();
                                    break;
                                case 1:
                                    if ((kb.Key == ConsoleKey.Enter) && (muzik == false))
                                    {
                                        player.SoundLocation = "1.wav";
                                        player.Play();
                                        player.Play();
                                        muzik = true;// wlacz wlacz dzwieki + zmiana stanu DODAC FUNKCJE WYLACZENIA DZWIEKOW
                                        Console.Clear();
                                        highlight_menu(1, muzik);
                                    }
                                    else if ((kb.Key == ConsoleKey.Enter) && (muzik == true))
                                    {
                                        player.Stop();
                                        muzik = false;// wylacz wlacz dzwieki + zmiana stanu
                                        ClearCurrentConsoleLine(20);
                                        Console.ForegroundColor = ConsoleColor.Red;
                                        Console.SetCursorPosition(0, 20);
                                        Console.Write(music_OFF);

                                    }
                                    break;
                                case 2:
                                    scoreboard.muzik = this.muzik;
                                    scoreboard.wypisz(false);
                                    break;
                                case 3:
                                    Environment.Exit(0);
                                    break;
                            }
                            break;
                        case ConsoleKey.Escape:
                            Environment.Exit(0);
                            break;
                    }
            }
        }