Esempio n. 1
0
        public int DisplayGetPlayerObjectToPickUp()
        {
            int  gameObjectId      = 0;
            bool validGameObjectId = false;

            //
            // get a list of player objects in the current map location
            //
            List <PlayerObject> playerObjectsInMapLocation = _gameKingdom.GetPlayerObjectsByMapLocationId(_gamePlayer.MapLocationID);

            if (playerObjectsInMapLocation.Count > 0)
            {
                DisplayGamePlayScreen("Pick Up Game Object", Text.GameObjectsChooseList(playerObjectsInMapLocation), ActionMenu.ObjectMenu, "");

                while (!validGameObjectId)
                {
                    //
                    // get an integer from the player
                    //
                    GetInteger($"Enter the Id number of the object you wish to add to your inventory: ", 0, 0, out gameObjectId);

                    //
                    // validate integer as a valid game object id and in current location
                    //
                    if (_gameKingdom.IsValidPlayerObjectByLocationId(gameObjectId, _gamePlayer.MapLocationID))
                    {
                        PlayerObject playerObject = _gameKingdom.GetGameObjectById(gameObjectId) as PlayerObject;
                        validGameObjectId = true;
                        //if (playerObject.CanInventory)
                        //{
                        //    validGameObjectId = true;
                        //}
                        //else
                        //{
                        //    ClearInputBox();
                        //    DisplayInputErrorMessage("It appears you may not inventory that object. Please try again.");
                        //}
                    }
                    else
                    {
                        ClearInputBox();
                        DisplayInputErrorMessage("It appears you entered an invalid game object id. Please try again.");
                    }
                }
            }
            else
            {
                DisplayGamePlayScreen("Pick Up Game Object", "It appears there are no game objects here.", ActionMenu.ObjectMenu, "");
            }

            return(gameObjectId);
        }