Ejemplo n.º 1
0
        /// <summary>
        /// Opens the inventory
        /// </summary>
        public static void Action()
        {
            string result = "";
            InventoryMenu menu = new InventoryMenu();

            do
            {
                // If an input did not exit the loop,
                // execute it.
                if (result.Length != 0)
                {
                    int id = int.Parse(result);
                    if (Adventure.Human.UseItem(id))
                        return;
                    else
                    {
                        ConsoleTools.DrawDesign(ConsoleTools.cannotUseItem);
                        ConsoleTools.DrawDesign(ConsoleTools.inventory);
                    }
                }

                result = menu.Show();
            }
            while (!result.Equals(""));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Accesses the inventory
        /// </summary>
        /// <returns>null if smokebomb was used, true if another item was used, or false otherwise</returns>
        public static Boolean? Inventory()
        {
            string result = "";
            InventoryMenu menu = new InventoryMenu();

            do
            {
                // If an input did not exit the loop,
                // execute it.
                if (result.Length != 0)
                {
                    int id = int.Parse(result);
                    if (!Adventure.Human.UseItem(id))
                    {
                        ConsoleTools.DrawDesign(ConsoleTools.cannotUseItem);
                        ConsoleTools.DrawDesign(ConsoleTools.inventory);
                    }
                    else if (id == 5)
                        return null;
                    else
                        return true;
                }

                result = menu.Show();
            }
            while (!result.Equals(""));
            return false;
        }