Esempio n. 1
0
        public void ToggleStorage(Inventory inventory)
        {
            storageSlotManager.AssignInventory(inventory);

            UI.ToggleBag(true);
            UI.ToggleStorage(true);
            currTransferSlots = storageSlotManager;
        }
Esempio n. 2
0
        public void ToggleShop(Inventory inventory)
        {
            shopSlotManager.AssignInventory(inventory);

            UI.ToggleBag(true);
            UI.ToggleShop(true);
            currTransferSlots = shopSlotManager;
        }
Esempio n. 3
0
        public void ToggleCharShop(Inventory inventory)
        {
            shopSlotManager.AssignInventory(inventory);

            UI.ToggleCharacters(true);
            UI.ToggleShop(true);
            currTransferSlots = characterSlotManager;
        }
Esempio n. 4
0
        public void ToggleCraft(Inventory inventory, ItemTag craftType)
        {
            craftSlotManager.AssignInventory(inventory);
            recipeSlotManager.AssignInventory(craftManager.GetRecipeInventory(craftType));
            craftManager.OnToggleCraftWindow(inventory);

            UI.ToggleBag(true);
            UI.ToggleCraft(true);
            currTransferSlots = craftSlotManager;
        }
Esempio n. 5
0
        public void CompleteTransaction(int amount)
        {
            ItemSlotHandler from = fromSlot.slotManager;
            ItemSlotHandler to;
            bool            monetary = false;

            if (toSlot)
            {
                to = toSlot.slotManager;
            }
            else if (from == bagSlotManager || from == characterSlotManager)
            {
                to = currTransferSlots;
            }
            else if (from == shopSlotManager && inCharacter)
            {
                to = characterSlotManager;
            }
            else
            {
                to = bagSlotManager;
            }

            if (inShop)
            {
                monetary = true;
            }

            if (inCraft && fromSlot.item.item is ItemRecipe)
            {
                if (craftSlotManager.inventory.totalItemsList.Count > 0)
                {
                    Inventory.Transfer(craftSlotManager.inventory, mainInventory, craftSlotManager.inventory.totalItemsList);
                }

                ItemRecipe recipe = fromSlot.item.item as ItemRecipe;
                for (int i = 0; i < recipe.ingredients.Count; ++i)
                {
                    Inventory.Transfer(bagSlotManager.inventory, craftSlotManager.inventory, recipe.ingredients[i].amount * amount, recipe.ingredients[i].item);
                }
                recipeSlotManager.inventory.RemoveItemAmount(fromSlot.item.item, amount, true);
            }
            else
            {
                Inventory.Transfer(from.inventory, to.inventory, amount, fromSlot.item.item, monetary);
            }
            fromSlot = null;
            toSlot   = null;
        }
Esempio n. 6
0
        void Start()
        {
            inventoryManager = InventoryManager.I;
            craftSlots       = inventoryManager.craftSlotManager;
            recipeSlots      = inventoryManager.recipeSlotManager;

            // recipe lists should be static with locked items, and vary with station
            // ie. base station recipes, base addon/better station adds/unhides recipes
            for (int i = 0; i < recipeLists.Count; ++i)
            {
                recipeLists[i].inv          = new Inventory(16, 0, true);
                recipeLists[i].inv.condHide = true;
                var list = AssetRegistry.I.GetItemListByTag(recipeLists[i].tag);
                if (list == null)
                {
                    continue;
                }
                for (int j = 0; j < list.Count; ++j)
                {
                    recipeLists[i].inv.AddItemAmount(list[j], 1, false);
                }
            }
        }