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); }
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(); }
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); }
// 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; }
// 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(); }
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); }
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(); } }
internal override void Slide(float _duration, Action _onPlayCallback, Ease _easeType, slideDirection _direction) { transform.SlideOut(_duration, _easeType, _onPlayCallback, true, false, _direction); }
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(); }
// 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(); }
internal abstract void Slide(float duration, Action onPlayCallback, EaseType easeType, slideDirection direction);
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(); }