示例#1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        var touchId = eventData.pointerId;

        if (ContainsTouchId(touchId))
        {
            return;
        }
        if (touchId1 == -1)
        {
            touchId1 = touchId;
            AddTouchId(touchId);
        }
        else if (touchId2 == -1)
        {
            touchId2 = touchId;
            AddTouchId(touchId);
        }
        if (touchId1 != -1 && touchId2 != -1)
        {
            CacheMobileSwipeArea.enabled = false;
            CacheMobilePinchArea.enabled = true;
            CacheMobilePinchArea.OnPointerDown(touchId1);
            CacheMobilePinchArea.OnPointerDown(touchId2);
        }
        else if (touchId1 != -1 || touchId2 != -1)
        {
            CacheMobileSwipeArea.enabled = true;
            CacheMobilePinchArea.enabled = false;
            CacheMobileSwipeArea.OnPointerDown(touchId1);
            CacheMobileSwipeArea.OnPointerDown(touchId2);
        }
    }
示例#2
0
 public void OnPointerUp(PointerEventData eventData)
 {
     --pointerCount;
     if (pointerCount >= 1)
     {
         CacheMobilePinchArea.OnPointerUp(eventData);
     }
     if (pointerCount == 0)
     {
         CacheMobileSwipeArea.OnPointerUp(eventData);
     }
 }
示例#3
0
 public void OnPointerDown(PointerEventData eventData)
 {
     ++pointerCount;
     if (pointerCount == 2)
     {
         CacheMobilePinchArea.OnPointerDown(eventData);
     }
     if (pointerCount == 1)
     {
         CacheMobilePinchArea.OnPointerDown(eventData);
         CacheMobileSwipeArea.OnPointerDown(eventData);
     }
 }
示例#4
0
    public void OnPointerUp(PointerEventData eventData)
    {
        var touchId = eventData.pointerId;

        if (touchId == touchId1)
        {
            RemoveTouchId(touchId);
            touchId1 = -1;
            CacheMobileSwipeArea.OnPointerUp(eventData);
            CacheMobilePinchArea.OnPointerUp(eventData);
        }
        if (touchId == touchId2)
        {
            RemoveTouchId(touchId);
            touchId2 = -1;
            CacheMobileSwipeArea.OnPointerUp(eventData);
            CacheMobilePinchArea.OnPointerUp(eventData);
        }
    }