Exemplo n.º 1
0
 public void StoreItem()
 {
     stach_container.StoreItem(this);
 }
Exemplo n.º 2
0
    private void SwapItems(BaseItemSlot tranferItemSlot)
    {
        ItemPickUp dragItem  = dragItemSlot.ITEM as ItemPickUp;
        int        dragIndex = dragItemSlot.INDEX;

        ItemPickUp tranferItem  = tranferItemSlot.ITEM as ItemPickUp;
        int        tranferIndex = tranferItemSlot.INDEX;


        if (dragItemSlot.GetType() != tranferItemSlot.GetType())
        {
            //inv to storage
            if (dragItemSlot is BaseInvSlot)
            {
                if (tranferItemSlot.ITEM != null)
                {
                    _inv_container.StoreItem(tranferItem, dragIndex);
                    _stach_container.StoreItem(dragItem, tranferIndex);
                }
                else
                {
                    if (_inv_container.RemoveItem(dragIndex))
                    {
                        _stach_container.StoreItem(dragItem, tranferIndex);
                    }
                }
            }
            else
            {
                //storage to inv
                if (dragItemSlot is BaseStachSlot)
                {
                    //has item
                    if (tranferItemSlot.ITEM != null)
                    {
                        _inv_container.StoreItem(dragItem, tranferIndex);
                        _stach_container.StoreItem(tranferItem, dragIndex);
                    }
                    else                    //hasn't item
                    {
                        if (_stach_container.RemoveItem(dragIndex))
                        {
                            _inv_container.StoreItem(dragItem, tranferIndex);
                        }
                    }
                }
            }
        }
        else
        {
            if (dragItemSlot is BaseInvSlot && dragItemSlot != null)
            {
                _inv_container.Swap(dragIndex, tranferIndex);
            }

            if (dragItemSlot is BaseStachSlot && dragItemSlot != null)
            {
                _stach_container.Swap(dragIndex, tranferIndex);
            }
        }
    }