private void OnEndDragging(UIDragModel dragModel, ItemCollectionSlotUIBase dragging, PointerEventData eventData)
        {
            Hide();

            if (eventData.hovered.Contains(gameObject))
            {
                if (dragModel.startItemCollection != collection)
                {
                    // As long as the player didn't directly drop it on a wrapper object, we can auto. equip it to the right slot.
                    bool droppedOnEquipSlot = false;
                    if (triggerWhenDroppedOnSlot == false)
                    {
                        foreach (var o in eventData.hovered)
                        {
                            var wrapper = o.GetComponent <ItemCollectionSlotUIBase>();
                            if (wrapper != null)
                            {
                                droppedOnEquipSlot = true;
                                break;
                            }
                        }
                    }

                    if (droppedOnEquipSlot == false)
                    {
                        var item = dragModel.startItemCollection[dragModel.startIndex].item;
                        iCollection.AcceptDragItem(item);

                        //Debug.Log("Dragged from other collection " + item.name);
                    }
                }
            }
        }
 protected virtual void InventoryUiDragUtilityOnOnStartDragging(UIDragModel dragModel, ItemCollectionSlotUIBase dragging, PointerEventData eventData)
 {
     if (dragging.item != null)
     {
         if (slot != null)
         {
             // Equippable character field
             if (equippableSlot != null)
             {
                 var equippable = dragging.item as EquippableInventoryItem;
                 if (equippable != null)
                 {
                     if (equippableSlot.equipmentTypes.Any(o => o == equippable.equipmentType))
                     {
                         SetOutlineValues();
                     }
                 }
             }
             else
             {
                 if (slot.itemCollection != null)
                 {
                     var canSet = slot.itemCollection.filters.IsItemAbidingFilters(dragging.item);
                     if (canSet)
                     {
                         SetOutlineValues();
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
 public UnstackSlotDragHandler(int priority)
     : base(priority)
 {
     dragModel = new UIDragModel();
 }
 public StandardSlotDragHandler(int priority)
     : base(priority)
 {
     dragModel = new UIDragModel();
 }
 private void OnStartDragging(UIDragModel dragModel, ItemCollectionSlotUIBase dragging, PointerEventData eventData)
 {
     TryShow();
 }
 protected virtual void InventoryUiDragUtilityOnOnEndDragging(UIDragModel dragModel, ItemCollectionSlotUIBase dragging, PointerEventData eventData)
 {
     RemoveOutlineValues();
 }
 protected DragHandlerBase(int priority)
 {
     this.priority  = priority;
     this.dragModel = new UIDragModel();
 }