Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (OperatingSystem.IsWindows())
            {
                SoundPlayer tetrisMusic = new SoundPlayer("Tetris_theme _lower_volume.wav");
                tetrisMusic.Load();
                tetrisMusic.PlayLooping();
            }


            string input;
            bool   loop = true;

            while (loop)
            {
                //console menu
                Console.WriteLine("Do you wanna play tetris");
                Console.WriteLine("1. Play");
                Console.WriteLine("2. View Highscore");
                Console.WriteLine("0. Quit");
                input = GetMenuInput(3);
                switch (input)
                {
                case "1":
                    Game game = new Game();
                    Console.CursorVisible = false;

                    Console.WriteLine("What level do you want to play on? [0-9]");
                    input = GetMenuInput(10);
                    game.MyScore.SetLevel(int.Parse(input));

                    //game started
                    Console.Clear();
                    game.Loop();
                    game.MyScore.SaveHighScore();
                    Console.Clear();
                    break;

                case "2":
                    Console.WriteLine("Your highscore is " + Score.LoadHighScore());
                    break;

                case "0":
                    Console.WriteLine("Bye bye!");
                    //Console.ReadKey();
                    loop = false;
                    break;

                default:
                    Console.WriteLine("Please write a valid option.");
                    break;
                }
            }
        }