public void OnDrop(PointerEventData eventData)
 {
     if (_dropped != null)
     {
         Drop(_dropped);
         _dropped = null;
     }
 }
 public void OnEndDrag(PointerEventData eventData)
 {
     if (_dragItem != null)
     {
         DestroyDragItem(_dragItem);
         _dragItem = null;
         _active   = null;
         if (_target != null)
         {
             _target.OnHover(null);
             _target = null;
         }
         OnDragEnd(eventData);
     }
 }
        public void OnBeginDrag(PointerEventData eventData)
        {
            if (_canvas == null)
            {
                _canvas = GetComponentInParent <Canvas>();
            }

            _cancel   = false;
            _active   = this;
            _dragItem = CreateDragItem();

            _dragItem.SetParent(GameManager.instance.tooltipCanvas, false);

            _itemStart  = transform.position;
            _mouseStart = eventData.position;

            _dragItem.position = _itemStart;

            OnDragBegin(eventData);
        }
示例#4
0
 protected virtual void OnMatchStart()
 {
     DragDropWidget.CancelDrag();
 }
        public void OnHover(DragDropWidget item)
        {
            var canDrop = Hover(item);

            _dropped = canDrop ? item : null;
        }
 protected abstract void Drop(DragDropWidget item);
 protected abstract bool Hover(DragDropWidget item);