/// <summary>
        /// setup the new Ogre object
        /// </summary>
        public void DisplayGameSetupIntro()
        {
            //
            // display header
            //
            ConsoleUtil.HeaderText = "Game Setup";
            ConsoleUtil.DisplayReset();

            //
            // display intro
            //
            ConsoleUtil.DisplayMessage("You will now be prompted to enter the starting parameters of your game.");
            DisplayContinuePrompt();
        }
        /// <summary>
        /// display the Exit prompt on a clean screen
        /// </summary>
        public void DisplayExitPrompt()
        {
            ConsoleUtil.HeaderText = "Exit";
            ConsoleUtil.DisplayReset();

            Console.CursorVisible = false;

            Console.WriteLine();
            ConsoleUtil.DisplayMessage("Thanks for playing my TB Quest Game.  Have a good day. Press any key to Exit.");

            Console.ReadKey();

            System.Environment.Exit(1);
        }
        public int DisplayPickUpItem()
        {
            ConsoleUtil.HeaderText = "Pick Up Item";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage("Items in current location");
            ConsoleUtil.DisplayMessage("");

            int  itemID        = 0;
            bool validResponse = false;

            int locationID;

            locationID = _gameOgre.SwampLocationID;
            while (!validResponse)
            {
                foreach (Item item in _gameKingdom.Items)
                {
                    if (item.SwampLocationID == locationID)
                    {
                        Console.WriteLine(item.GameObjectID);
                        Console.WriteLine(item.Name);
                        Console.WriteLine();
                    }
                }

                ConsoleUtil.DisplayPromptMessage("Enter Item Number:");

                if (int.TryParse(Console.ReadLine(), out itemID))
                {
                    if (itemID > 0 && itemID <= 6)
                    {
                        validResponse = true;
                    }

                    else
                    {
                        Console.WriteLine("Please select an option from the list");
                    }
                }
                else
                {
                    Console.WriteLine("Please select an option from the list");
                }
            }
            DisplayContinuePrompt();

            return(itemID);
        }
예제 #4
0
        /// <summary>
        /// display the Exit prompt on a clean screen
        /// </summary>
        public void DisplayExitPrompt()
        {
            ConsoleUtil.HeaderText = "Exit";
            ConsoleUtil.DisplayReset();

            Console.CursorVisible = false;

            Console.WriteLine();
            ConsoleUtil.DisplayMessage("Thank you for playing The TARDIS Project. Press any key to Exit.");

            Console.ReadKey();

            System.Environment.Exit(1);
        }
        /// <summary>
        /// get and validate the player's race
        /// </summary>
        /// <returns>race as a RaceType</returns>
        public Ogre.RaceType DisplayGetOgresRace()
        {
            bool validResponse = false;

            Ogre.RaceType ogresRace = Ogre.RaceType.None;

            while (!validResponse)
            {
                //
                // display header
                //
                ConsoleUtil.HeaderText = "Ogre's Race";
                ConsoleUtil.DisplayReset();

                //
                // display all race types on a line
                //
                ConsoleUtil.DisplayMessage("Races");
                StringBuilder sb = new StringBuilder();
                foreach (Character.RaceType raceType in Enum.GetValues(typeof(Character.RaceType)))
                {
                    if (raceType != Character.RaceType.None)
                    {
                        sb.Append($" [{raceType}] ");
                    }
                }
                ConsoleUtil.DisplayMessage(sb.ToString());

                ConsoleUtil.DisplayPromptMessage("Enter Your Ogre's Race: ");

                //
                // validate user response for race
                //
                if (Enum.TryParse <Character.RaceType>(Console.ReadLine(), out ogresRace))
                {
                    validResponse = true;
                    ConsoleUtil.DisplayReset();
                    ConsoleUtil.DisplayMessage($"You have indicated {ogresRace} as your race type.");
                }
                else
                {
                    ConsoleUtil.DisplayMessage("You must limit your race to the list above.");
                    ConsoleUtil.DisplayMessage("Please reenter your race.");
                }

                DisplayContinuePrompt();
            }

            return(ogresRace);
        }
예제 #6
0
        /// <summary>
        /// display the current traveler information
        /// </summary>
        public void DisplayTravelerInfo()
        {
            ConsoleUtil.HeaderText = "TimeTraveler Info";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage($"TimeTraveler's Name: {_gameTraveler.Name}");
            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage($"TimeTraveler's Race: {_gameTraveler.Race}");
            ConsoleUtil.DisplayMessage("");
            string YearTimeLocationName = _gameYLocation.GetYearTimeLocationByID(_gameTraveler.YearTimeLocationID).Name;

            ConsoleUtil.DisplayMessage($"TimeTraveler's Current Location: {YearTimeLocationName}");

            DisplayContinuePrompt();
        }
        /// <summary>
        /// display a list of all Swamp destinations
        /// <summary>
        public void DisplayListAllSwampDestinations()
        {
            ConsoleUtil.HeaderText = "Swamp Locations";
            ConsoleUtil.DisplayReset();

            foreach (SwampLocation location in _gameKingdom.SwampLocations)
            {
                ConsoleUtil.DisplayMessage("ID: " + location.SwampLocationID);
                ConsoleUtil.DisplayMessage("Name: " + location.Name);
                ConsoleUtil.DisplayMessage("Description: " + location.Description);
                ConsoleUtil.DisplayMessage("Accessible: " + location.Accessable);
                ConsoleUtil.DisplayMessage("");
            }

            DisplayContinuePrompt();
        }
예제 #8
0
        /// <summary>
        /// display a list of all TARDIS destinations
        /// <summary>
        public void DisplayListAllTARDISDestinations()
        {
            ConsoleUtil.HeaderText = "Year-Time locations";
            ConsoleUtil.DisplayReset();

            foreach (YearLocation location in _gameYLocation.YearTimeLocations)
            {
                ConsoleUtil.DisplayMessage("ID: " + location.YearLocationID);
                ConsoleUtil.DisplayMessage("Name: " + location.Name);
                ConsoleUtil.DisplayMessage("Description: " + location.Description);
                ConsoleUtil.DisplayMessage("Accessible: " + location.Accessable);
                ConsoleUtil.DisplayMessage("");
            }

            DisplayContinuePrompt();
        }
        public int DisplayPutDownTreasure()
        {
            ConsoleUtil.HeaderText = "Put Down Treasure";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage("Treasures in current inventory");
            ConsoleUtil.DisplayMessage("");

            int  treasureToPutDown = _gameOgre.SwampLocationID;
            bool validResponse     = false;

            int locationID;

            locationID = _gameOgre.SwampLocationID;
            while (!validResponse)
            {
                foreach (Treasure treasure in _gameOgre.OgresTreasures)
                {
                    Console.WriteLine(treasure.GameObjectID);
                    Console.WriteLine(treasure.Name);
                    Console.WriteLine();
                }

                ConsoleUtil.DisplayPromptMessage("Enter Treasure Number To Put Down:");
                if (int.TryParse(Console.ReadLine(), out treasureToPutDown))
                {
                    if (treasureToPutDown > 0 && treasureToPutDown <= 4)
                    {
                        validResponse = true;
                    }
                    else
                    {
                        Console.WriteLine("Please select an option from the list");
                    }
                }
                else
                {
                    Console.WriteLine("Please select an option from the list");
                }
            }
            DisplayContinuePrompt();

            return(treasureToPutDown);
        }
예제 #10
0
        /// <summary>
        /// display the current traveler inventory
        /// </summary>
        public void DisplayTravelerItems()
        {
            ConsoleUtil.HeaderText = "TimeTraveler Inventory";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("TimeTraveler Items");
            ConsoleUtil.DisplayMessage("");

            foreach (Item item in _gameTraveler.TimeTravelersItems)
            {
                ConsoleUtil.DisplayMessage("ID: " + item.GameObjectID);
                ConsoleUtil.DisplayMessage("Name: " + item.Name);
                ConsoleUtil.DisplayMessage("Description: " + item.Description);
                ConsoleUtil.DisplayMessage("");
            }

            DisplayContinuePrompt();
        }
        /// <summary>
        /// display the current ogre's inventory
        /// </summary>
        public void DisplayOgreItems()
        {
            ConsoleUtil.HeaderText = "Ogre's Inventory";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("Ogre's Items");
            ConsoleUtil.DisplayMessage("");

            foreach (Item item in _gameOgre.OgresItems)
            {
                ConsoleUtil.DisplayMessage("ID: " + item.GameObjectID);
                ConsoleUtil.DisplayMessage("Name: " + item.Name);
                ConsoleUtil.DisplayMessage("Description: " + item.Description);
                ConsoleUtil.DisplayMessage("");
            }

            DisplayContinuePrompt();
        }
        /// <summary>
        /// display the current ogre's treasure
        /// </summary>
        public void DisplayOgreTreasure()
        {
            ConsoleUtil.HeaderText = "Ogre's Treasure";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage("Ogre's Treasure");
            ConsoleUtil.DisplayMessage("");

            foreach (Treasure treasure in _gameOgre.OgresTreasures)
            {
                ConsoleUtil.DisplayMessage("ID: " + treasure.GameObjectID);
                ConsoleUtil.DisplayMessage("Name: " + treasure.Name);
                ConsoleUtil.DisplayMessage("Description: " + treasure.Description);
                ConsoleUtil.DisplayMessage("");
            }

            DisplayContinuePrompt();
        }
        /// <summary>
        /// display the current ogre information
        /// </summary>
        public void DisplayOgreInfo()
        {
            ConsoleUtil.HeaderText = "Ogre Info";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage($"Ogre's Name: {_gameOgre.Name}");
            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage($"Ogre's Race: {_gameOgre.Race}");
            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage($"Ogre's Age: {_gameOgre.Age}");
            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage($"Ogre's Health: {_gameOgre.Health}");
            ConsoleUtil.DisplayMessage("");
            string swampLocationName = _gameKingdom.GetSwampLocationByID(_gameOgre.SwampLocationID).Name;

            ConsoleUtil.DisplayMessage($"Ogre's Current Location: {swampLocationName}");

            DisplayContinuePrompt();
        }
예제 #14
0
        /// <summary>
        /// display the current traveler's treasure
        /// </summary>
        public void DisplayTravelerTreasure()
        {
            ConsoleUtil.HeaderText = "TimeTraveler Inventory";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage("TimeTraveler Treasure");
            ConsoleUtil.DisplayMessage("");

            foreach (Treasure treasure in _gameTraveler.TimeTravelersTreasures)
            {
                ConsoleUtil.DisplayMessage("ID: " + treasure.GameObjectID);
                ConsoleUtil.DisplayMessage("Name: " + treasure.Name);
                ConsoleUtil.DisplayMessage("Description: " + treasure.Description);
                ConsoleUtil.DisplayMessage("");
            }

            DisplayContinuePrompt();
        }
예제 #15
0
        /// <summary>
        /// get player's name
        /// </summary>
        /// <returns>name as a string</returns>
        public string DisplayGetTravelersName()
        {
            string travelersName;

            //
            // display header
            //
            ConsoleUtil.HeaderText = "TimeTraveler's Name";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayPromptMessage("Enter your name: ");
            travelersName = Console.ReadLine();

            ConsoleUtil.DisplayReset();
            ConsoleUtil.DisplayMessage($"You have indicated {travelersName} as your name.");

            DisplayContinuePrompt();

            return(travelersName);
        }
        /// <summary>
        /// get player's name
        /// </summary>
        /// <returns>name as a string</returns>
        public string DisplayGetOgresName()
        {
            string ogresName;

            //
            // display header
            //
            ConsoleUtil.HeaderText = "Ogre's Name";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayPromptMessage("Please Enter Your Ogre's Name: ");
            ogresName = Console.ReadLine();

            ConsoleUtil.DisplayReset();
            ConsoleUtil.DisplayMessage($"You have indicated {ogresName} as your name.");

            DisplayContinuePrompt();

            return(ogresName);
        }
        /// <summary>
        /// display a message confirming game setup
        /// </summary>
        public void DisplayMissionSetupConfirmation()
        {
            //
            // display header
            //
            ConsoleUtil.HeaderText = "Game Setup";
            ConsoleUtil.DisplayReset();
            ConsoleUtil.HeaderText = "Game Setup";
            ConsoleUtil.DisplayReset();

            //
            // display confirmation
            //
            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage("Your game setup is complete.");
            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage("To view your ogre information use the Main Menu.");

            DisplayContinuePrompt();
        }
        public void DisplayTalkTo()
        {
            int           locationID     = _gameOgre.SwampLocationID;
            List <Dragon> dragonsInSwamp = new List <Dragon>();
            Dragon        dragonToTalkTo = new Dragon();

            dragonsInSwamp = _gameKingdom.GetDragonsBySwampLocationID(locationID);

            ConsoleUtil.HeaderText = "Talk To";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage(_gameKingdom.GetSwampLocationByID(locationID).Name);
            ConsoleUtil.DisplayMessage("");

            if (dragonsInSwamp != null)
            {
                ConsoleUtil.DisplayMessage("");
                ConsoleUtil.DisplayMessage("Dragons in Current location.");
                foreach (Dragon dragon in _gameKingdom.Dragons)
                {
                    if (dragon.SwampLocationID == locationID)
                    {
                        Console.WriteLine(dragon.CharacterID + " - " + dragon.Name);
                        Console.WriteLine();
                    }
                }
                ConsoleUtil.DisplayPromptMessage("Select a number to speak with a dragon.");
                Console.WriteLine();
                int dragonIDChoice;

                if (int.TryParse(Console.ReadLine(), out dragonIDChoice))
                {
                    dragonToTalkTo = _gameKingdom.GetDragonByID(dragonIDChoice);
                    ConsoleUtil.DisplayMessage(dragonToTalkTo.Message);
                }

                DisplayContinuePrompt();
            }
        }
예제 #19
0
        /// <summary>
        /// display information about the current space-time location
        /// </summary>
        public void DisplayLookAround()
        {
            ConsoleUtil.HeaderText = "Current Space-Time Location Info";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage(_gameYLocation.GetYearTimeLocationByID(_gameTraveler.YearTimeLocationID).Description);

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage("Items in current location.");
            foreach (Item item in _gameYLocation.GetItemtsByYearTimeLocationID(_gameTraveler.YearTimeLocationID))
            {
                ConsoleUtil.DisplayMessage(item.Name + " - " + item.Description);
            }

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage("Treasures in current location.");
            foreach (Treasure treasure in _gameYLocation.GetTreasuressByYearTimeLocationID(_gameTraveler.YearTimeLocationID))
            {
                ConsoleUtil.DisplayMessage(treasure.Name + " - " + treasure.Description);
            }

            DisplayContinuePrompt();
        }
예제 #20
0
        /// <summary>
        /// get the action choice from the user
        /// </summary>
        public TimeTravelerAction DisplayGetTravelerActionChoice()
        {
            TimeTravelerAction travelerActionChoice = TimeTravelerAction.None;
            bool usingMenu = true;

            while (usingMenu)
            {
                //
                // set up display area
                //
                ConsoleUtil.HeaderText = "TimeTraveler Action Choice";
                ConsoleUtil.DisplayReset();
                Console.CursorVisible = false;

                //
                // display the menu
                //
                ConsoleUtil.DisplayMessage("What would you like to do (Type Number).");
                Console.WriteLine();
                Console.WriteLine(
                    "\t" + "1. Look Around" + Environment.NewLine +
                    "\t" + "2. Travel" + Environment.NewLine +
                    "\t" + "3. Display TimeTraveler Info" + Environment.NewLine +
                    "\t" + "4. Display TimeTraveler Inventory" + Environment.NewLine +
                    "\t" + "5. Display TimeTraveler Treasure" + Environment.NewLine +
                    "\t" + "6. Display All TARDIS Destinations" + Environment.NewLine +
                    "\t" + "7. Display All Game Items" + Environment.NewLine +
                    "\t" + "8. Display All Game Treasures" + Environment.NewLine +
                    "\t" + "E. Exit" + Environment.NewLine);

                //
                // get and process the user's response
                // note: ReadKey argument set to "true" disables the echoing of the key press
                //
                ConsoleKeyInfo userResponse = Console.ReadKey(true);
                switch (userResponse.KeyChar)
                {
                case '1':
                    travelerActionChoice = TimeTravelerAction.LookAround;
                    usingMenu            = false;
                    break;

                case '2':
                    travelerActionChoice = TimeTravelerAction.Travel;
                    usingMenu            = false;
                    break;

                case '3':
                    travelerActionChoice = TimeTravelerAction.TravelerInfo;
                    usingMenu            = false;
                    break;

                case '4':
                    travelerActionChoice = TimeTravelerAction.TravelerInventory;
                    usingMenu            = false;
                    break;

                case '5':
                    travelerActionChoice = TimeTravelerAction.TravelerTreasure;
                    usingMenu            = false;
                    break;

                case '6':
                    travelerActionChoice = TimeTravelerAction.ListYearDestinations;
                    usingMenu            = false;
                    break;

                case '7':
                    travelerActionChoice = TimeTravelerAction.ListItems;
                    usingMenu            = false;
                    break;

                case '8':
                    travelerActionChoice = TimeTravelerAction.ListTreasures;
                    usingMenu            = false;
                    break;

                case 'E':
                case 'e':
                    travelerActionChoice = TimeTravelerAction.Exit;
                    usingMenu            = false;
                    break;

                default:
                    Console.WriteLine(
                        "It appears you have selected an incorrect choice." + Environment.NewLine +
                        "Press any key to continue or the ESC key to quit the application.");

                    userResponse = Console.ReadKey(true);
                    if (userResponse.Key == ConsoleKey.Escape)
                    {
                        usingMenu = false;
                    }
                    break;
                }
            }
            Console.CursorVisible = true;

            return(travelerActionChoice);
        }
        public void DisplayLookAt()
        {
            int             locationID      = _gameOgre.SwampLocationID;
            List <Item>     itemsInSwamp    = new List <Item>();
            List <Treasure> treasureInSwamp = new List <Treasure>();
            Item            itemToSee       = new Item();
            Treasure        treasureToSee   = new Treasure();

            itemsInSwamp    = _gameKingdom.GetItemsBySwampLocationID(locationID);
            treasureInSwamp = _gameKingdom.GetTreasuresBySwampLocationID(locationID);

            ConsoleUtil.HeaderText = "Items in Current Location";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("");
            ConsoleUtil.DisplayMessage(_gameKingdom.GetSwampLocationByID(locationID).Name);
            ConsoleUtil.DisplayMessage("");

            if (itemsInSwamp != null)
            {
                ConsoleUtil.DisplayMessage("");
                ConsoleUtil.DisplayMessage("Items in Current location.");
                foreach (Item item in _gameKingdom.Items)
                {
                    if (item.SwampLocationID == locationID)
                    {
                        Console.WriteLine(item.GameObjectID + " - " + item.Name);
                        Console.WriteLine();
                    }
                }
                ConsoleUtil.DisplayPromptMessage("Enter item number or press Enter to move on to Treasures.");
                Console.WriteLine();
                int itemIDChoice;

                if (int.TryParse(Console.ReadLine(), out itemIDChoice))
                {
                    itemToSee = _gameKingdom.GetItemtByID(itemIDChoice);
                    ConsoleUtil.DisplayMessage(itemToSee.Description);

                    DisplayContinuePrompt();
                }
            }

            if (treasureInSwamp != null)
            {
                ConsoleUtil.DisplayMessage("");
                ConsoleUtil.DisplayMessage("Treasures in Current location.");
                foreach (Treasure treasure in _gameKingdom.Treasures)
                {
                    if (treasure.SwampLocationID == locationID)
                    {
                        Console.WriteLine(treasure.GameObjectID + " - " + treasure.Name);
                        Console.WriteLine();
                    }
                }
                ConsoleUtil.DisplayPromptMessage("Enter treasure number or press Enter to move on.");
                Console.WriteLine();
                int treasureIDChoice;

                if (int.TryParse(Console.ReadLine(), out treasureIDChoice))
                {
                    treasureToSee = _gameKingdom.GetTreasuretByID(treasureIDChoice);
                    ConsoleUtil.DisplayMessage(treasureToSee.Description);

                    DisplayContinuePrompt();
                }
            }
        }
        /// <summary>
        /// get the action choice from the user
        /// </summary>
        public OgreAction DisplayGetOgreActionChoice()
        {
            OgreAction ogreActionChoice = OgreAction.None;
            bool       usingMenu        = true;

            while (usingMenu)
            {
                //
                // set up display area
                //
                ConsoleUtil.HeaderText = "Ogre Action Choice";
                ConsoleUtil.DisplayReset();
                Console.CursorVisible = false;

                //
                // display the menu
                //
                ConsoleUtil.DisplayMessage("What would you like to do (Type Letter).");
                Console.WriteLine();
                Console.WriteLine(
                    "\t" + "**************************" + Environment.NewLine +
                    "\t" + "Ogre Actions" + Environment.NewLine +
                    "\t" + "**************************" + Environment.NewLine +
                    "\t" + "A. Look Around" + Environment.NewLine +
                    "\t" + "B. Talk To" + Environment.NewLine +
                    "\t" + "C. Look At" + Environment.NewLine +
                    "\t" + "D. Pick Up Item" + Environment.NewLine +
                    "\t" + "E. Pick Up Treasure" + Environment.NewLine +
                    "\t" + "F. Put Down Item" + Environment.NewLine +
                    "\t" + "G. Put Down Treasure" + Environment.NewLine +
                    "\t" + "H. Travel" + Environment.NewLine +
                    "\t" + Environment.NewLine +
                    "\t" + "**************************" + Environment.NewLine +
                    "\t" + "Traveler Information" + Environment.NewLine +
                    "\t" + "**************************" + Environment.NewLine +
                    "\t" + "I. Display General Ogre Info" + Environment.NewLine +
                    "\t" + "J. Display Ogre Inventory" + Environment.NewLine +
                    "\t" + "K. Display Ogre Treasures" + Environment.NewLine +
                    "\t" + Environment.NewLine +
                    "\t" + "**************************" + Environment.NewLine +
                    "\t" + "Game Information" + Environment.NewLine +
                    "\t" + "**************************" + Environment.NewLine +
                    "\t" + "L. Display All Swamp Destinations" + Environment.NewLine +
                    "\t" + "M. Display All Game Items" + Environment.NewLine +
                    "\t" + "N. Display All Game Treasures" + Environment.NewLine +
                    "\t" + Environment.NewLine +
                    "\t" + "**************************" + Environment.NewLine +
                    "\t" + "Q. Quit" + Environment.NewLine);

                //
                // get and process the user's response
                // note: ReadKey argument set to "true" disables the echoing of the key press
                //
                ConsoleKeyInfo userResponse = Console.ReadKey(true);
                switch (userResponse.KeyChar)
                {
                case 'A':
                case 'a':
                    ogreActionChoice = OgreAction.LookAround;
                    usingMenu        = false;
                    break;

                case 'B':
                case 'b':
                    ogreActionChoice = OgreAction.TalkTo;
                    usingMenu        = false;
                    break;

                case 'C':
                case 'c':
                    ogreActionChoice = OgreAction.LookAt;
                    usingMenu        = false;
                    break;

                case 'D':
                case 'd':
                    ogreActionChoice = OgreAction.PickUpItem;
                    usingMenu        = false;
                    break;

                case 'E':
                case 'e':
                    ogreActionChoice = OgreAction.PickUpTreasure;
                    usingMenu        = false;
                    break;

                case 'F':
                case 'f':
                    ogreActionChoice = OgreAction.PutDownItem;
                    usingMenu        = false;
                    break;

                case 'G':
                case 'g':
                    ogreActionChoice = OgreAction.PutDownTreasure;
                    usingMenu        = false;
                    break;

                case 'H':
                case 'h':
                    ogreActionChoice = OgreAction.Travel;
                    usingMenu        = false;
                    break;

                case 'I':
                case 'i':
                    ogreActionChoice = OgreAction.OgreInfo;
                    usingMenu        = false;
                    break;

                case 'J':
                case 'j':
                    ogreActionChoice = OgreAction.OgreInventory;
                    usingMenu        = false;
                    break;

                case 'K':
                case 'k':
                    ogreActionChoice = OgreAction.OgreTreasure;
                    usingMenu        = false;
                    break;

                case 'L':
                case 'l':
                    ogreActionChoice = OgreAction.ListSwampDestinations;
                    usingMenu        = false;
                    break;

                case 'M':
                case 'm':
                    ogreActionChoice = OgreAction.ListItems;
                    usingMenu        = false;
                    break;

                case 'N':
                case 'n':
                    ogreActionChoice = OgreAction.ListTreasures;
                    usingMenu        = false;
                    break;

                case 'Q':
                case 'q':
                    ogreActionChoice = OgreAction.Exit;
                    usingMenu        = false;
                    break;

                default:
                    Console.WriteLine(
                        "It appears you have selected an incorrect choice." + Environment.NewLine +
                        "Press any key to continue or the ESC key to quit the application.");

                    userResponse = Console.ReadKey(true);
                    if (userResponse.Key == ConsoleKey.Escape)
                    {
                        usingMenu = false;
                    }
                    break;
                }
            }
            Console.CursorVisible = true;

            return(ogreActionChoice);
        }
        /// <summary>
        /// get and validate the player's TARDIS destination
        /// </summary>
        /// <returns>space-time location</returns>
        public SwampLocation DisplayGetOgresNewDestination()
        {
            bool          validResponse = false;
            int           swampID;
            SwampLocation nextSwampLocation = new SwampLocation();

            while (!validResponse)
            {
                //
                // display header
                //
                ConsoleUtil.HeaderText = "Swamp Destination";
                ConsoleUtil.DisplayReset();

                //
                // display a table of space-time locations
                //
                DisplaySwampDestinationsTable();

                //
                // get and validate user's response for a space-time location
                //
                ConsoleUtil.DisplayPromptMessage("Choose your swamp location by using its ID: ");

                //
                // user's response is an integer
                //
                if (int.TryParse(Console.ReadLine(), out swampID))
                {
                    ConsoleUtil.DisplayMessage("");



                    try
                    {
                        nextSwampLocation = _gameKingdom.GetSwampLocationByID(swampID);

                        ConsoleUtil.DisplayReset();
                        ConsoleUtil.DisplayMessage($"You have indicated {nextSwampLocation.Name} as your destination.");
                        ConsoleUtil.DisplayMessage("");

                        if (nextSwampLocation.Accessable == true)
                        {
                            validResponse = true;
                            ConsoleUtil.DisplayMessage("Your journey continues.");
                        }
                        else
                        {
                            ConsoleUtil.DisplayMessage("It appears this destination is not available to you at this time.");
                            ConsoleUtil.DisplayMessage("Please make another choice.");
                        }
                    }
                    //
                    // user's response was not in the correct range
                    //
                    catch (ArgumentOutOfRangeException ex)
                    {
                        ConsoleUtil.DisplayMessage("It appears you entered an invalid location ID.");
                        ConsoleUtil.DisplayMessage(ex.Message);
                        ConsoleUtil.DisplayMessage("Please try again.");
                    }
                }
                //
                // user's response was not an integer
                //
                else
                {
                    ConsoleUtil.DisplayMessage("It appears you did not enter a number for the location ID.");
                    ConsoleUtil.DisplayMessage("Please try again.");
                }

                DisplayContinuePrompt();
            }

            return(nextSwampLocation);
        }
예제 #24
0
        /// <summary>
        /// get and validate the player's TARDIS destination
        /// </summary>
        /// <returns>space-time location</returns>
        public YearLocation DisplayGetTravelersNewDestination()
        {
            bool         validResponse = false;
            int          locationID;
            YearLocation nextYearTimeLocation = new YearLocation();

            while (!validResponse)
            {
                //
                // display header
                //
                ConsoleUtil.HeaderText = "TARDIS Destination";
                ConsoleUtil.DisplayReset();

                //
                // display a table of year-time locations
                //
                DisplayTARDISDestinationsTable();

                //
                // get and validate user's response for a space-time location
                //
                ConsoleUtil.DisplayPromptMessage("Choose the TARDIS destination by entering the ID: ");

                //
                // user's response is an integer
                //
                if (int.TryParse(Console.ReadLine(), out locationID))
                {
                    ConsoleUtil.DisplayMessage("");

                    try
                    {
                        nextYearTimeLocation = _gameYLocation.GetYearTimeLocationByID(locationID);

                        ConsoleUtil.DisplayReset();
                        ConsoleUtil.DisplayMessage($"You have indicated {nextYearTimeLocation.Name} as your TARDIS destination.");
                        ConsoleUtil.DisplayMessage("");

                        if (nextYearTimeLocation.Accessable == true)
                        {
                            validResponse = true;
                            ConsoleUtil.DisplayMessage("You will be transported immediately.");
                        }
                        else
                        {
                            ConsoleUtil.DisplayMessage("It appears this destination is not available to you at this time.");
                            ConsoleUtil.DisplayMessage("Please make another choice.");
                        }
                    }
                    //
                    // user's response was not in the correct range
                    //
                    catch (ArgumentOutOfRangeException ex)
                    {
                        ConsoleUtil.DisplayMessage("It appears you entered an invalid location ID.");
                        ConsoleUtil.DisplayMessage(ex.Message);
                        ConsoleUtil.DisplayMessage("Please try again.");
                    }
                }
                //
                // user's response was not an integer
                //
                else
                {
                    ConsoleUtil.DisplayMessage("It appears you did not enter a number for the location ID.");
                    ConsoleUtil.DisplayMessage("Please try again.");
                }

                DisplayContinuePrompt();
            }

            return(nextYearTimeLocation);
        }