コード例 #1
0
    void OnAddItem_AddItem(ItemObject item)
    {
        //BagItemObject _container = Global.Component.GetPlayerBag();
        ContainerPack _containerPack = GetContainerPack();

        if (_containerPack == null)
        {
            //TODO все забито
        }

        IItemList <ItemObject> _innerItems = _containerPack.GetInnerItems();
        IRender    _render    = _containerPack.GetRender();
        GameObject _container = _containerPack.GetContainer();

        if (_innerItems != null)
        {
            //if (_container.IsFuLL() == false)
            //{

            if (IsOpen(_container) == true)
            {
                _innerItems.Add(item);
                _render.Add(item);
            }
            else
            {
                item.inventoryData.SetSlotID(_render.GetFreeSlotID((ItemObject)_innerItems));
                _innerItems.Add(item);
            }
            //}
        }
    }