Example #1
0
        private ActionsForMenu MenuLoop()
        {
            bool needToRender = true;

            do
            {
                ConsoleKeyInfo pressedChar = Console.ReadKey(true);
                switch (pressedChar.Key)
                {
                case ConsoleKey.LeftArrow:
                    gameWindow.setPreviousButtonActive();
                    break;

                case ConsoleKey.RightArrow:
                    gameWindow.setNextButtonActive();
                    break;

                case ConsoleKey.Enter:
                    //todo:

                    switch (gameWindow.GetActiveButton().TextLine.Data)
                    {
                    case "Continue":
                        return(ActionsForMenu.Continue);

                    case "Main menu":
                        return(ActionsForMenu.MainMenu);

                    case "Quit":
                        Environment.Exit(0);
                        return(ActionsForMenu.Quit);
                    }
                    break;

                case ConsoleKey.Escape:
                    return(ActionsForMenu.Restart);
                }
            } while (needToRender);
            return(ActionsForMenu.Restart);
        }