IEnumerator transitionView() { //toggleInteract(); Vector3 thisExit = nextView.exit; thisExit.z -= 1; float duration = nextView.time; float diagonal = new Vector2(Screen.width, Screen.height).magnitude * 0.5f; Vector2 moveExit = new Vector2(thisExit.x, thisExit.y) * -diagonal; nextView.reset(true); Vector2 a, b; if (lastView?.rect) { a = lastView.rect.anchoredPosition + moveExit; LeanTween.move(lastView.rect.gameObject, a, duration); //, a, duration ).setEase( LeanTweenType.easeInOutCubic ); } b = nextView.rect.anchoredPosition; nextView.rect.anchoredPosition -= moveExit; LeanTween.moveLocal(nextView.rect.gameObject, b, duration); //move( nextView.rect, b, duration ).setEase( LeanTweenType.easeInOutCubic ); yield return(new WaitForSeconds(duration)); lastView?.reset(false); nextView.reset(true); nowView = nextView; nowViewName = nextViewName; nextViewName = ""; frozen = false; inputRay.enabled = true; //toggleInteract( true ); yield return(null); }
public void closeView() { if (disabled) { return; } if (viewStack.Count < 2) { return; } frozen = true; nextViewName = lastViewName; nextView = lastView; lastViewName = nowViewName; lastView = nowView; nowViewName = null; nowView = null; viewStack.Pop(); StartCoroutine("transitionView"); }