private void OnAddItemSuc(InventoryItem ii)
        {
            BackpackItem backpackItem = Backpack.CreateBackpackItem(ItemContainer);

            backpackItem.Initialize(Backpack, ii, delegate { OnHoverBackpackItem?.Invoke(backpackItem); }, delegate { OnHoverEndBackpackItem?.Invoke(backpackItem); });
            backpackItems.Add(ii.GUID, backpackItem);
        }
        private void OnRemoveItemSuc(InventoryItem ii)
        {
            BackpackItem bi = backpackItems[ii.GUID];

            bi.PoolRecycle();
            backpackItems.Remove(ii.GUID);
        }
示例#3
0
        public BackpackItem CreateBackpackItem(Transform transform)
        {
            if (InstantiateBackpackItemHandler != null)
            {
                MonoBehaviour mono = InstantiateBackpackItemHandler?.Invoke(transform);
                if (mono != null)
                {
                    try
                    {
                        BackpackItem res = (BackpackItem)mono;
                        return(res);
                    }
                    catch (Exception e)
                    {
                        LogError(e.ToString());
                    }
                }
            }

            return(null);
        }