コード例 #1
0
        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);
                    }
                }
            }
        }
コード例 #2
0
 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();
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
 public UnstackSlotDragHandler(int priority)
     : base(priority)
 {
     dragModel = new UIDragModel();
 }
コード例 #4
0
 public StandardSlotDragHandler(int priority)
     : base(priority)
 {
     dragModel = new UIDragModel();
 }
コード例 #5
0
 private void OnStartDragging(UIDragModel dragModel, ItemCollectionSlotUIBase dragging, PointerEventData eventData)
 {
     TryShow();
 }
コード例 #6
0
 protected virtual void InventoryUiDragUtilityOnOnEndDragging(UIDragModel dragModel, ItemCollectionSlotUIBase dragging, PointerEventData eventData)
 {
     RemoveOutlineValues();
 }
コード例 #7
0
 protected DragHandlerBase(int priority)
 {
     this.priority  = priority;
     this.dragModel = new UIDragModel();
 }