コード例 #1
0
    private void TouchHandler()
    {
        Touch touch;

        //返回一个在触摸开始阶段时非触摸UI的触摸点
        if (m_touchFingerId > -1)
        {
            touch           = InputUtil.GetTouchWithFingerId(m_touchFingerId);
            m_touchFingerId = touch.fingerId;
        }
        else
        {
            touch           = InputUtil.GetTouchNonPointerOverUI(TouchPhase.Began);
            m_touchFingerId = touch.fingerId;
        }

        if (touch.fingerId > -1)
        {
            if (GetPositionOnActiveArea(touch.position, advancedOptions.activeArea))
            {
                float h = touch.deltaPosition.x * 0.5f;
                if (!m_isRotateBegin)
                {
                    m_isRotateBegin = true;
                    onPreRotateEvent?.Invoke(h);
                }
                Rotate(h);
            }
        }
    }