예제 #1
0
        public override void OnBeginDrag(PointerEventData eventData)
        {
            if (eventData.button == dragButton && slot.current != null)
            {
                if (transform.parent.gameObject.name != "Temporary Collection 1 UI")
                {
                    slot.collection.SwapOrMerge(slot.collectionIndex, TempCollection.tempCollections[0], 0, slot.collection.GetAmount(slot.collectionIndex));
                    TempCollection.staticTempCollecion1UI.GetComponentInChildren <ImprovedDrag>().OnBeginDrag(eventData);
                    GetComponentInParent <DynamicLayoutGroup>()?.ForceRebuildNow();
                    return;
                }

                var dragClone = GetDragObject(eventData, GetComponentInParent <Canvas>()?.rootCanvas);
                dragClone.GetComponent <Image>().enabled = false;
                dragClone.sizeDelta = dragClone.sizeDelta * new Vector2(slot.current.layoutShape.convexX, slot.current.layoutShape.convexY);
                DragAndDropUtility.BeginDrag(new DragAndDropUtility.Model(GetComponent <RectTransform>(), dragClone, slot.current), eventData);

                if (consumeEvent)
                {
                    eventData.Use();
                }

                if (handlePointerClick)
                {
                    activeCoroutine = StartCoroutine(ManualDragLoop());
                }
                WorkshopController.workshopController.UpdateBorders((UnityEquippableItemInstance)TempCollection.tempCollections[0][0]);
                TooltipController.ManualUpdate();
            }
        }
        public virtual void OnBeginDrag(PointerEventData eventData)
        {
            if (eventData.button == dragButton && slot.current != null)
            {
                var dragClone = GetDragObject(eventData, GetComponentInParent <Canvas>()?.rootCanvas);
                DragAndDropUtility.BeginDrag(new DragAndDropUtility.Model(GetComponent <RectTransform>(), dragClone, slot.current), eventData);

                if (consumeEvent)
                {
                    eventData.Use();
                }

                if (handlePointerClick)
                {
                    activeCoroutine = StartCoroutine(ManualDragLoop());
                }
            }
        }