Exemple #1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (touchDownEvent != null)
        {
            touchDownEvent.Invoke();
        }

        touchDownStartTime = Time.time;

        if (cameraCenter != null)
        {
            if (Input.touches.Length == 2)
            {
                zConutOffset  = 0;
                disVec2       = new Vector2(Input.touches[0].position.x - Input.touches[1].position.x, Input.touches[0].position.y - Input.touches[1].position.y).magnitude;
                disVec2_first = disVec2;
                zCountStart   = cameraCenter.currentCamera.Zcount;

                firstPosition = Input.touches[0].position;
                secondPostion = Input.touches[1].position;

                inZoom  = true;
                inTouch = false;
                cameraCenter.currentCamera.inZoomState = true;
            }
            else if (Input.touches.Length == 1)
            {
                xConutOffset  = 0;
                yConutOffset  = 0;
                firstPosition = Input.touches[0].position;

                inZoom = false;
                cameraCenter.currentCamera.inZoomState = false;
                inTouch = true;
            }

            flip = !flip;

            if (flip)
            {
                aClickPosition = eventData.position;
                mTimeA         = Time.time;
            }
            else
            {
                bClickPosition = eventData.position;
                mTimeB         = Time.time;
            }

            if (Mathf.Abs(mTimeA - mTimeB) < 0.3f && Vector2.Distance(aClickPosition, bClickPosition) < 30)
            {
                hxfbColliderTriggerEvent.Invoke(eventData);
                cameraCenter.currentCamera.DoubleClick(eventData.position);
            }

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
            xConutOffset  = 0;
            yConutOffset  = 0;
            firstPosition = eventData.position;
#endif

            cameraCenter.currentCamera.TouchDown(firstPosition);
        }
    }