示例#1
0
 // Attach the Instance
 private void Awake()
 {
     m_Instance    = this;
     optionSide    = false;
     startingPos   = new Vector2(2059.0f, 385.0f);
     oppositePos   = new Vector2(-2036.0f, 385.0f);
     rotating      = false;
     rotatingTimer = 0.0f;
     rotateTime    = 0.6f;
 }
    // Update is called once per frame
    void Update()
    {
        // If at option Pannel...
        if (RotatePivot.GetInstance().GetPannelIndex() == 3 ||
            RotatePivot.GetInstance().GetPannelIndex() == 7)
        {
            // If a GO was Clicked
            if (Swipe.GetInstance().GetCurrentSelectedGO() != null)
            {
                // Detect Language Clicking
                DetectLanguageChange();
            }

            // Detect Up Swipe
            if (Swipe.GetInstance().GetSwipeUp())
            {
                float finalHeight = rectTransform.anchoredPosition.y + (Swipe.GetInstance().GetSwipeDelta().y * 9.0f);
                if (finalHeight > maxHeight)
                {
                    rectTransform.DOAnchorPosY(maxHeight, 0.5f, true);
                }
                else
                {
                    rectTransform.DOAnchorPosY(finalHeight, 0.5f, true);
                }

                Debug.Log("UP SWIPE!!");
            }
            // Detect Down Swipe
            else if (Swipe.GetInstance().GetSwipeDown())
            {
                float finalHeight = rectTransform.anchoredPosition.y + (Swipe.GetInstance().GetSwipeDelta().y * 9.0f);
                if (finalHeight < minHeight)
                {
                    rectTransform.DOAnchorPosY(minHeight, 0.5f, true);
                }
                else
                {
                    rectTransform.DOAnchorPosY(finalHeight, 0.5f, true);
                }

                Debug.Log("DOWN SWIPE!!");
            }


            // Detect Right Swipe
            if (Swipe.GetInstance().GetSwipeRight())
            {
                // if within the shortcut section and swiped
                if (RectTransformUtility.RectangleContainsScreenPoint(shortCutSectionTransform, Swipe.GetInstance().GetLastTouchedPosition()))
                {
                    shortCutSectionTransform.DOAnchorPosX(minShortcutX, 0.4f, true);
                }
            }
            // Detect Left Swipe
            else if (Swipe.GetInstance().GetSwipeLeft())
            {
                // if within the shortcut section and swiped
                if (RectTransformUtility.RectangleContainsScreenPoint(shortCutSectionTransform, Swipe.GetInstance().GetLastTouchedPosition()))
                {
                    shortCutSectionTransform.DOAnchorPosX(maxShortcutX, 0.4f, true);
                }
            }
        }   // End of Panel Checking
    }