protected virtual void Drag(VRTK_UIPointer pointer, List <RaycastResult> results)
        {
            pointer.pointerEventData.dragging = pointer.IsSelectionButtonPressed() && pointer.pointerEventData.delta != Vector2.zero;

            if (pointer.pointerEventData.pointerDrag)
            {
                if (!ValidElement(pointer.pointerEventData.pointerDrag))
                {
                    pointer.pointerEventData.pointerDrag = null;
                    return;
                }

                if (pointer.pointerEventData.dragging)
                {
                    if (IsHovering(pointer))
                    {
                        ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    }
                }
                else
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.endDragHandler);
                    for (int i = 0; i < results.Count; i++)
                    {
                        ExecuteEvents.ExecuteHierarchy(results[i].gameObject, pointer.pointerEventData, ExecuteEvents.dropHandler);
                    }
                    pointer.pointerEventData.pointerDrag = null;
                }
            }
            else if (pointer.pointerEventData.dragging)
            {
                for (int i = 0; i < results.Count; i++)
                {
                    RaycastResult result = results[i];
                    if (!ValidElement(result.gameObject))
                    {
                        continue;
                    }

                    ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.initializePotentialDrag);
                    ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.beginDragHandler);
                    GameObject target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    if (target != null)
                    {
                        pointer.pointerEventData.pointerDrag = target;
                        break;
                    }
                }
            }
        }
Example #2
0
 // Token: 0x0600176E RID: 5998 RVA: 0x0007D730 File Offset: 0x0007B930
 protected virtual void Drag(VRTK_UIPointer pointer, List <RaycastResult> results)
 {
     pointer.pointerEventData.dragging = (pointer.IsSelectionButtonPressed() && pointer.pointerEventData.delta != Vector2.zero);
     if (pointer.pointerEventData.pointerDrag)
     {
         if (!this.ValidElement(pointer.pointerEventData.pointerDrag))
         {
             pointer.pointerEventData.pointerDrag = null;
             return;
         }
         if (!pointer.pointerEventData.dragging)
         {
             ExecuteEvents.ExecuteHierarchy <IDragHandler>(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler);
             ExecuteEvents.ExecuteHierarchy <IEndDragHandler>(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.endDragHandler);
             foreach (RaycastResult raycastResult in results)
             {
                 ExecuteEvents.ExecuteHierarchy <IDropHandler>(raycastResult.gameObject, pointer.pointerEventData, ExecuteEvents.dropHandler);
             }
             pointer.pointerEventData.pointerDrag = null;
             return;
         }
         if (this.IsHovering(pointer))
         {
             ExecuteEvents.ExecuteHierarchy <IDragHandler>(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler);
             return;
         }
     }
     else if (pointer.pointerEventData.dragging)
     {
         foreach (RaycastResult raycastResult2 in results)
         {
             if (this.ValidElement(raycastResult2.gameObject))
             {
                 ExecuteEvents.ExecuteHierarchy <IInitializePotentialDragHandler>(raycastResult2.gameObject, pointer.pointerEventData, ExecuteEvents.initializePotentialDrag);
                 ExecuteEvents.ExecuteHierarchy <IBeginDragHandler>(raycastResult2.gameObject, pointer.pointerEventData, ExecuteEvents.beginDragHandler);
                 GameObject gameObject = ExecuteEvents.ExecuteHierarchy <IDragHandler>(raycastResult2.gameObject, pointer.pointerEventData, ExecuteEvents.dragHandler);
                 if (gameObject != null)
                 {
                     pointer.pointerEventData.pointerDrag = gameObject;
                     break;
                 }
             }
         }
     }
 }