コード例 #1
0
        /// <summary>
        /// display and get next locations
        /// </summary>
        /// <returns></returns>
        public int DisplayGetNextLocation()
        {
            int  spaceTimeLocationId      = 0;
            bool validSpaceTimeLocationId = false;

            DisplayGamePlayScreen("Travel to a Chamber", Text.Travel(_gamePlayer, _gameUniverse.SpaceTimeLocations), ActionMenu.MainMenu, "");

            while (!validSpaceTimeLocationId)
            {
                //
                // get an integer from the player
                //
                GetInteger($"Enter your new chamber {_gamePlayer.Name}: ", 1, _gameUniverse.GetMaxSpaceTimeLocationId(), out spaceTimeLocationId);

                //
                // validate integer as a valid location ID and determine accessibility
                //
                if (_gameUniverse.IsValidSpaceTimeLocationId(spaceTimeLocationId))
                {
                    if (_gameUniverse.IsAccessibleLocation(spaceTimeLocationId))
                    {
                        validSpaceTimeLocationId = true;
                    }
                    else
                    {
                        ClearInputBox();
                        DisplayInputErrorMessage("It appears you attempting to travel to an inaccessible chamber. Please try again.");
                    }
                }
                else
                {
                    DisplayInputErrorMessage("It appears you entered an invalid chamber ID. Please try again.");
                }
            }

            return(spaceTimeLocationId);
        }