예제 #1
0
 public void DisableParamsInCase()
 {
     isFilteringInServer = false;
     dirCurrent          = slideDirection.nullDirection;
     hadDirection        = false;
     filterVisulizer.GetComponent <FilterVisulizer>().enableQuad('x', false);
     filterVisulizer.GetComponent <FilterVisulizer>().enableQuad('y', false);
     filterVisulizer.GetComponent <FilterVisulizer>().enableQuad('z', false);
 }
예제 #2
0
    public void ProcessClientOneRange(Touch touch)
    {
        if (touch.phase == TouchPhase.Began)
        {
            isFilteringInClient = true;
            posStart1           = touch.position;
            dirCurrent          = slideDirection.nullDirection;
            hadDirection        = false;
            lowerFilterDelta    = 0f;
            upperFilterDelta    = 0f;
        }
        else if (touch.phase == TouchPhase.Moved)
        {
            isFilteringInClient = true;
            posCurrent1         = touch.position;
            if (!hadDirection)
            {
                dirCurrent = slideDirection.frontback;
                //? InitFilterBoundary('z', zlb, zub);
                //InitSlider('z');
                hadDirection = true;
            }
            if (posStart1.x < screenWidth * 0.5f)
            {
                lowerFilterDelta = touch.deltaPosition.x / screenWidth * filterPanRatio;
                upperFilterDelta = 0f;
            }
            else if (posStart1.x >= screenWidth * 0.5f)
            {
                lowerFilterDelta = 0f;
                upperFilterDelta = touch.deltaPosition.x / screenWidth * filterPanRatio;
            }
            else
            {
                lowerFilterDelta = 0f;
                upperFilterDelta = 0f;
            }

            if (Mathf.Abs(posCurrent1.x - posStart1.x) < minFilter1PanDistance)
            {
                lowerFilterDelta = 0f;
                upperFilterDelta = 0f;
            }
        }
        else if (touch.phase == TouchPhase.Ended)
        {
            isFilteringInClient = false;
            dirCurrent          = slideDirection.nullDirection;
            hadDirection        = false;
        }
        // deliver filterDalta to server -> do in TouchProcessor.cs
        DeliverConvertedRangeValue();
    }
예제 #3
0
        public static ITween <Vector3> SlideOut(this Transform transform,
                                                float duration,
                                                EaseType easeType         = EaseType.Linear,
                                                Action onCompleteCallback = null,
                                                bool deactiveOnComplete   = false,
                                                bool blockRaycast         = false,
                                                slideDirection direction  = slideDirection.up)
        {
            CanvasGroup image    = InitCanvasGroup(transform, blockRaycast);
            var         xOffset  = Screen.width;
            var         yOffset  = Screen.height;
            var         startPos = transform.position;
            var         destPos  = transform.position;

            switch (direction)
            {
            case slideDirection.left:
                destPos += new Vector3(-xOffset, 0f);
                break;

            case slideDirection.right:
                destPos += new Vector3(xOffset, 0f);
                break;

            case slideDirection.up:
                destPos += new Vector3(0, yOffset);
                break;

            case slideDirection.down:
                destPos += new Vector3(0, -yOffset);
                break;
            }
            ITween <Vector3> tween = transform.ZKpositionTo(destPos, duration);

            tween.setEaseType(easeType);
            tween.setCompletionHandler((t) =>
            {
                if (onCompleteCallback != null)
                {
                    onCompleteCallback.Invoke();
                }
                image.blocksRaycasts = true;
                transform.position   = startPos;
                if (deactiveOnComplete)
                {
                    transform.gameObject.SetActive(false);
                }
            });
            tween.start();
            return(tween);
        }
예제 #4
0
    // Start is called before the first frame update
    void Start()
    {
        screenWidth  = Screen.width;
        screenHeight = Screen.height;

        dirCurrent       = slideDirection.nullDirection;
        posStart1        = posStart2 = posCurrent1 = posCurrent2 = Vector3.zero;
        lowerFilterDelta = upperFilterDelta = 0f;

        minzSlider = minSliderRange;
        minzSlider = maxSliderRange;

        hadDirection        = false;
        isFilteringInClient = false;
    }
예제 #5
0
    // Start is called before the first frame update
    void Start()
    {
        screenWidth  = Screen.width;
        screenHeight = Screen.height;

        dirCurrent = slideDirection.nullDirection;
        //vecCurrent = slideVector.nullVector;
        posStart1        = posStart2 = posCurrent1 = posCurrent2 = Vector3.zero;
        lowerFilterDelta = upperFilterDelta = 0f;

        minxSlider = minySlider = minSliderRange;
        maxxSlider = maxySlider = maxSliderRange;

        hadDirection = false;

        updateAnchorPosition();
    }
예제 #6
0
        public static Tweener SlideIn(this Transform transform,
                                      float duration,
                                      Ease easeType             = Ease.Linear,
                                      Action onCompleteCallback = null,
                                      bool deactiveOnComplete   = false,
                                      bool blockRaycast         = false,
                                      slideDirection direction  = slideDirection.up)
        {
            CanvasGroup image    = InitCanvasGroup(transform, blockRaycast);
            var         xOffset  = Screen.width;
            var         yOffset  = Screen.height;
            var         startPos = transform.position;

            switch (direction)
            {
            case slideDirection.left:
                transform.position += new Vector3(-xOffset, 0f);
                break;

            case slideDirection.right:
                transform.position += new Vector3(xOffset, 0f);
                break;

            case slideDirection.up:
                transform.position += new Vector3(0, yOffset);
                break;

            case slideDirection.down:
                transform.position += new Vector3(0, -yOffset);
                break;
            }
            Tweener tween = transform.DOMove(startPos, duration);

            FillOutTween(transform, easeType, onCompleteCallback, deactiveOnComplete, image, tween);
            return(tween);
        }
예제 #7
0
 public void ProcessClientRange(bool clientFiltering, float minn, float maxx)
 {
     if (!isFilteringInServer)
     {
         isFilteringInClient = clientFiltering;
         if (isFilteringInClient)
         {
             hadDirection = true;
             dirCurrent   = slideDirection.frontback;
             InitFilterBoundary('y', ylb, yub);
             InitFilterBoundary('z', xlb, xub);
             InitQuadBoundary('x', rtxlb, rtxub);
             InitQuadBoundary('y', rtylb, rtyub);
             lowerFilterDelta = minn;
             upperFilterDelta = maxx;
         }
         else
         {
             hadDirection = false;
             dirCurrent   = slideDirection.nullDirection;
         }
         DeliverConvertedRangeValue();
     }
 }
예제 #8
0
 internal override void Slide(float _duration, Action _onPlayCallback, Ease _easeType, slideDirection _direction)
 {
     transform.SlideOut(_duration, _easeType, _onPlayCallback, true, false, _direction);
 }
예제 #9
0
    public void ProcessServerBothRange(Touch touch1, Touch touch2)
    {
        if (touch1.phase == TouchPhase.Began || touch2.phase == TouchPhase.Began)
        {
            isFilteringInServer = true;
            posStart1           = touch1.position;
            posStart2           = touch2.position;
            dirCurrent          = slideDirection.nullDirection;
            hadDirection        = false;
        }
        else if (touch1.phase == TouchPhase.Moved || touch2.phase == TouchPhase.Moved)
        {
            isFilteringInServer = true;
            posCurrent1         = touch1.position;
            posCurrent2         = touch2.position;
            Vector2 deltaPos1 = touch1.deltaPosition;
            Vector2 deltaPos2 = touch2.deltaPosition;

            if (!hadDirection)
            {
                if ((Mathf.Abs(deltaPos1.x) >= Mathf.Abs(deltaPos2.x) &&
                     Mathf.Abs(deltaPos1.x) >= Mathf.Abs(deltaPos1.y) &&
                     Mathf.Abs(deltaPos1.x) >= Mathf.Abs(deltaPos2.y)) ||
                    (Mathf.Abs(deltaPos2.x) >= Mathf.Abs(deltaPos1.x) &&
                     Mathf.Abs(deltaPos2.x) >= Mathf.Abs(deltaPos1.y) &&
                     Mathf.Abs(deltaPos2.x) >= Mathf.Abs(deltaPos2.y))
                    )
                {
                    dirCurrent = slideDirection.leftright;
                    InitFilterBoundary('x', zlb, zub);
                    InitFilterBoundary('y', ylb, yub);
                    InitQuadBoundary('y', rtylb, rtyub);
                    InitQuadBoundary('z', rtzlb, rtzub);
                }
                else
                {
                    dirCurrent = slideDirection.updown;
                    InitFilterBoundary('z', xlb, xub);
                    InitFilterBoundary('x', zlb, zub);
                    InitQuadBoundary('x', rtxlb, rtxub);
                    InitQuadBoundary('z', rtzlb, rtzub);
                }
                hadDirection = true;
            }

            // touch1 is left, touch2 is right
            if (posCurrent1.x <= posCurrent2.x && dirCurrent == slideDirection.leftright)
            {
                lowerFilterDelta = deltaPos1.x / screenWidth * filterPanRatio;
                upperFilterDelta = deltaPos2.x / screenWidth * filterPanRatio;

                if (Mathf.Abs(posCurrent1.x - posStart1.x) < minFilter2PanDistance)
                {
                    lowerFilterDelta = 0f;
                }
                if (Mathf.Abs(posCurrent2.x - posStart2.x) < minFilter2PanDistance)
                {
                    upperFilterDelta = 0f;
                }
            }
            // touch1 is right, touch2 is left
            else if (posCurrent1.x > posCurrent2.x && dirCurrent == slideDirection.leftright)
            {
                lowerFilterDelta = deltaPos2.x / screenWidth * filterPanRatio;
                upperFilterDelta = deltaPos1.x / screenWidth * filterPanRatio;

                if (Mathf.Abs(posCurrent1.x - posStart1.x) < minFilter2PanDistance)
                {
                    upperFilterDelta = 0f;
                }
                if (Mathf.Abs(posCurrent2.x - posStart2.x) < minFilter2PanDistance)
                {
                    lowerFilterDelta = 0f;
                }
            }
            // touch1 is down, touch2 is up
            else if (posCurrent1.y <= posCurrent2.y && dirCurrent == slideDirection.updown)
            {
                lowerFilterDelta = deltaPos1.y / screenWidth * filterPanRatio;
                upperFilterDelta = deltaPos2.y / screenWidth * filterPanRatio;

                if (Mathf.Abs(posCurrent1.y - posStart1.y) < minFilter2PanDistance)
                {
                    lowerFilterDelta = 0f;
                }
                if (Mathf.Abs(posCurrent2.y - posStart2.y) < minFilter2PanDistance)
                {
                    upperFilterDelta = 0f;
                }
            }
            // touch1 is up, touch2 is down
            else if (posCurrent1.y > posCurrent2.y && dirCurrent == slideDirection.updown)
            {
                lowerFilterDelta = deltaPos2.y / screenWidth * filterPanRatio;
                upperFilterDelta = deltaPos1.y / screenWidth * filterPanRatio;

                if (Mathf.Abs(posCurrent1.y - posStart1.y) < minFilter2PanDistance)
                {
                    upperFilterDelta = 0f;
                }
                if (Mathf.Abs(posCurrent2.y - posStart2.y) < minFilter2PanDistance)
                {
                    lowerFilterDelta = 0f;
                }
            }
            // something bad happened
            else
            {
                lowerFilterDelta = 0f;
                upperFilterDelta = 0f;
            }
            //if (Mathf.Abs(lowerFilterDelta) < minFilter2Ratio) lowerFilterDelta = 0f;
            //if (Mathf.Abs(upperFilterDelta) < minFilter2Ratio) upperFilterDelta = 0f;
        }
        else if (touch1.phase == TouchPhase.Ended || touch2.phase == TouchPhase.Ended)
        {
            isFilteringInServer = false;
            dirCurrent          = slideDirection.nullDirection;
            hadDirection        = false;
        }

        DeliverConvertedRangeValue();
    }
예제 #10
0
    // abondoned, need fix after axes rotation
    public void ProcessServerOneRange(Touch touch)
    {
        if (touch.phase == TouchPhase.Began)
        {
            isFilteringInServer = true;
            posStart1           = touch.position;
            dirCurrent          = slideDirection.nullDirection;
            hadDirection        = false;
        }
        else if (touch.phase == TouchPhase.Moved)
        {
            isFilteringInServer = true;
            posCurrent1         = touch.position;
            if (!hadDirection)
            {
                if (Mathf.Abs(touch.deltaPosition.x) > Mathf.Abs(touch.deltaPosition.y))
                {
                    dirCurrent = slideDirection.leftright;
                    //InitSlider('y');
                    InitFilterBoundary('y', ylb, yub);
                    //InitQuadBoundary('y', rtylb, rtyub);
                }
                else
                {
                    dirCurrent = slideDirection.updown;
                    //InitSlider('x');
                    InitFilterBoundary('x', xlb, xub);
                    //InitQuadBoundary('x', rtxlb, rtxub);
                }
                hadDirection = true;
            }

            if (posStart1.x < screenWidth * 0.5f && dirCurrent == slideDirection.leftright)
            {
                //?
                //cameraOrthSize = orthCamera.GetComponent<CameraController>().curCameraOrthSize;
                //lowerFilterDelta = touch.deltaPosition.x * Camera.main.orthographicSize / (screenHeight / 4);
                lowerFilterDelta = touch.deltaPosition.x / screenWidth * filterPanRatio;
                upperFilterDelta = 0f;
            }
            else if (posStart1.x >= screenWidth * 0.5f && dirCurrent == slideDirection.leftright)
            {
                lowerFilterDelta = 0f;
                //upperFilterDelta = touch.deltaPosition.x * Camera.main.orthographicSize / (screenHeight / 4);
                upperFilterDelta = touch.deltaPosition.x / screenWidth * filterPanRatio;
            }
            else if (posStart1.y < screenHeight * 0.5f && dirCurrent == slideDirection.updown)
            {
                lowerFilterDelta = touch.deltaPosition.y / screenWidth * filterPanRatio;
                upperFilterDelta = 0f;
            }
            else if (posStart1.y > screenHeight * 0.5f && dirCurrent == slideDirection.updown)
            {
                lowerFilterDelta = 0f;
                upperFilterDelta = touch.deltaPosition.y / screenWidth * filterPanRatio;
            }
            else
            {
                lowerFilterDelta = 0f;
                upperFilterDelta = 0f;
            }
            //if (Mathf.Abs(lowerFilterDelta) < minFilter1Ratio) lowerFilterDelta = 0f;
            //if (Mathf.Abs(upperFilterDelta) < minFilter1Ratio) upperFilterDelta = 0f;

            if (Mathf.Abs(posCurrent1.x - posStart1.x) < minFilter1PanDistance &&
                Mathf.Abs(posCurrent1.y - posStart1.y) < minFilter1PanDistance)
            {
                lowerFilterDelta = 0f;
                upperFilterDelta = 0f;
            }
        }
        else if (touch.phase == TouchPhase.Ended)
        {
            isFilteringInServer = false;
            dirCurrent          = slideDirection.nullDirection;
            hadDirection        = false;
        }
        DeliverConvertedRangeValue();
    }
예제 #11
0
 internal abstract void Slide(float duration, Action onPlayCallback, EaseType easeType, slideDirection direction);
예제 #12
0
    public void ProcessClientBothRange(Touch touch1, Touch touch2)
    {
        if (touch1.phase == TouchPhase.Began || touch2.phase == TouchPhase.Began)
        {
            isFilteringInClient = true;
            posStart1           = touch1.position;
            posStart2           = touch2.position;
            dirCurrent          = slideDirection.nullDirection;
            hadDirection        = false;
        }
        else if (touch1.phase == TouchPhase.Moved || touch2.phase == TouchPhase.Moved)
        {
            isFilteringInClient = true;
            posCurrent1         = touch1.position;
            posCurrent2         = touch2.position;
            Vector2 deltaPos1 = touch1.deltaPosition;
            Vector2 deltaPos2 = touch2.deltaPosition;

            if (!hadDirection)
            {
                dirCurrent   = slideDirection.frontback;
                hadDirection = true;
            }

            // touch1 is left/front, touch2 is right/back
            if (posCurrent1.x <= posCurrent2.x)
            {
                lowerFilterDelta = deltaPos1.x / screenWidth * filterPanRatio;
                upperFilterDelta = deltaPos2.x / screenWidth * filterPanRatio;
                if (Mathf.Abs(posCurrent1.x - posStart1.x) < minFilter2PanDistance)
                {
                    lowerFilterDelta = 0f;
                }
                if (Mathf.Abs(posCurrent2.x - posStart2.x) < minFilter2PanDistance)
                {
                    upperFilterDelta = 0f;
                }
            }
            // touch1 is right/back, touch2 is left/front
            else if (posCurrent1.x > posCurrent2.x)
            {
                lowerFilterDelta = deltaPos2.x / screenWidth * filterPanRatio;
                upperFilterDelta = deltaPos1.x / screenWidth * filterPanRatio;
                if (Mathf.Abs(posCurrent1.x - posStart1.x) < minFilter2PanDistance)
                {
                    upperFilterDelta = 0f;
                }
                if (Mathf.Abs(posCurrent2.x - posStart2.x) < minFilter2PanDistance)
                {
                    lowerFilterDelta = 0f;
                }
            }
            // something bad happened
            else
            {
                lowerFilterDelta = 0f;
                upperFilterDelta = 0f;
            }
            //if (Mathf.Abs(lowerFilterDelta) < minFilter2Ratio) lowerFilterDelta = 0f;
            //if (Mathf.Abs(upperFilterDelta) < minFilter2Ratio) upperFilterDelta = 0f;
        }
        else if (touch1.phase == TouchPhase.Ended || touch2.phase == TouchPhase.Ended)
        {
            isFilteringInClient = false;
            dirCurrent          = slideDirection.nullDirection;
            hadDirection        = false;
        }
        Debug.Log("dy6- direction: " + dirCurrent.ToString());
        DeliverConvertedRangeValue();
    }