public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            Container cont = this.GetContainer(target);

            if (cont == null)
            {
                return(true);
            }

            if (this.item.item == null)
            {
                return(true);
            }
            cont.RemoveItem(this.item.item.uuid, this.amount.GetInt(target));

            return(true);
        }
Beispiel #2
0
        public override void OnClickButton()
        {
            Container container = this.containerUIManager.currentContainer;

            int addAmount = InventoryManager.Instance.AddItemToInventory(this.item.uuid, 1);

            if (addAmount <= 0)
            {
                return;
            }

            container.RemoveItem(this.item.uuid, addAmount);

            this.containerUIManager.UpdateItems();
            if (this.containerUIManager.onRemove != null)
            {
                this.containerUIManager.onRemove.Invoke(this.item.uuid);
            }
        }
Beispiel #3
0
        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            Container cont = this.GetContainer(target);

            if (cont == null)
            {
                return(true);
            }

            List <Container.ItemData> items = cont.GetItems();

            for (int i = 0; i < items.Count; ++i)
            {
                Container.ItemData item = items[i];

                InventoryManager.Instance.AddItemToInventory(item.uuid, item.amount);
                cont.RemoveItem(item.uuid, item.amount);
            }

            return(true);
        }