/// <summary>
        /// Called everytime when drag is stop moving before OnEndDrag is called
        /// Useful to vaidate drop item
        /// </summary>
        public override void OnDrop(PointerEventData eventData)
        {
            GameObject    droppedObject = eventData.pointerDrag;
            BaseDraggable item          = droppedObject.GetComponent <BaseDraggable>();

            item.UpdateParentHolder(this.transform);
        }
        /// <summary>
        /// Called everytime when drag is stop moving before OnEndDrag is called
        /// Useful to vaidate drop item
        /// </summary>
        public override void OnDrop(PointerEventData eventData)
        {
            GameObject droppedObject = eventData.pointerDrag;

            /// On Drop, if parent transform is an instance of BaseDroppable class then update parent transform
            BaseDraggable item = droppedObject.GetComponent <BaseDraggable>();

            if (item != null)
            {
                item.UpdateParentHolder(this.transform);
            }
        }
        /// <summary>
        /// Called everytime when drag is stop moving
        /// Disables new group layout or any layout with no child
        /// </summary>
        public override void OnAnyItemDragEnd(BaseDraggable item)
        {
            foreach (GameObject groupLayout in groupLayouts)
            {
                if (groupLayout.transform == item.draggingHandlerParent)
                {
                    continue;
                }

                if (groupLayout.transform.childCount == 0)
                {
                    groupLayout.SetActive(false);
                }
            }
        }
        /// =========================== Callback funtions ==================== ///

        #region Callback functions
        /// <summary>
        /// Called everytime when drag is started
        /// Enables new group layout for card separation
        /// </summary>
        public override void OnAnyItemDragStart(BaseDraggable item)
        {
            if (item.draggingHandlerParent.childCount == 1)
            {
                return;
            }

            GameObject groupLayout = groupLayouts.Where(x => !(x.activeSelf)).FirstOrDefault();

            if (groupLayout != null)
            {
                groupLayout.SetActive(true);
                groupLayout.transform.SetAsLastSibling();
            }
        }
Пример #5
0
 /// <summary>
 /// On any item drag end enable all items raycast
 /// </summary>
 /// <param name="item"> dragged item </param>
 public virtual void OnAnyItemDragEnd(BaseDraggable item)
 {
 }
Пример #6
0
        /// =========================== Callback funtions ==================== ///

        #region Callback functions
        /// <summary>
        /// On any item drag start need to disable all items raycast for correct drop operation
        /// </summary>
        /// <param name="item"> dragged item </param>
        public virtual void OnAnyItemDragStart(BaseDraggable item)
        {
        }