示例#1
0
        public void Init()
        {
            Audio.StartServiceTrack("menu", true);
            pressedKey = new ConsoleKeyInfo();
            Render();

            t = new Thread(delegate()
            {
                do
                {
                    pressedKey = Console.ReadKey(true);
                } while (true);
            });

            Thread.Sleep(100);
            AnimateMenuItem();
            t.Start();

            exit = false;
            do
            {
                switch (pressedKey.Key)
                {
                case ConsoleKey.D1:
                    Audio.StopTrack();
                    t.Abort();
                    exit = true;
                    Menu.Play();
                    break;

                case ConsoleKey.D2:
                    Audio.StopTrack();

                    Menu.Rank();
                    pressedKey = new ConsoleKeyInfo();

                    break;

                case ConsoleKey.D3:
                    Menu.Exit();
                    break;

                case ConsoleKey.Escape:
                    Menu.Exit();
                    break;

                case ConsoleKey.DownArrow:
                    MoveSelectedDown();
                    pressedKey = new ConsoleKeyInfo();
                    break;

                case ConsoleKey.UpArrow:
                    MoveSelectedUp();
                    pressedKey = new ConsoleKeyInfo();
                    break;

                case ConsoleKey.Enter:
                    Audio.StopTrack();

                    EnterAction();
                    break;
                }
            } while (!exit);
        }