Example #1
0
        public static bool ShowMenu()
        {
            if (SaveLoadService.CheckIfGamesaveExists())
            {
                player = SaveLoadService.Load();
            }
            bool atMenu = true;

            Console.Clear();
            while (atMenu)
            {
                Console.Clear();
                bool   continueCondition = player != null && player.IsAlive;
                string continueOption    = continueCondition ? "\n[2]Continue" : "";
                Console.WriteLine("Welcome to Rougelike by DrMayx!\n\n" +
                                  "Close game only from main menu.\n" +
                                  "Game saves automatically on closing." +
                                  $"\n\n[1]Start new Game{continueOption}\n[9]Exit");

                switch (Console.ReadKey().Key)
                {
                case ConsoleKey.D1:
                    player = PlayerTile.CreateNewPlayer();
                    return(true);

                case ConsoleKey.D2:
                    if (continueCondition)
                    {
                        return(true);
                    }
                    break;

                case ConsoleKey.D9:
                    return(false);

                case ConsoleKey.D0:
                    ShowDebugInfo();
                    break;
                }
            }
            return(false);
        }