void Start() { //initial view presentation and hiding other view foreach (UIView view in Views) { view.ViewWillDissappear(); view.SetVisible(false); view.ViewDisappeared(); } initialView.ViewWillAppear(); initialView.SetVisible(true); initialView.ViewAppeared(); StartCoroutine(RefreshEventSystem()); }
private void PerformFromMainThread() { //make sure new view is presented on top if (transitionType == TransitionType.presentOnTop) { targetView.camera.depth = sourceView.camera.depth + 1; } if (!animatedTransition) { if (sourceViewDismiss) { sourceView.ViewWillDissappear(); } if (targetViewAppear) { targetView.ViewWillAppear(sourceView); } if (sourceViewDismiss) { sourceView.SetVisible(false); } if (targetViewAppear) { targetView.SetVisible(true); } TransitionCompleted(); } else { //animated transitions if (sourceViewDismiss) { sourceView.ViewWillDissappear(); } if (targetViewAppear) { targetView.ViewWillAppear(sourceView); } //animated code here if (animatedTransitionType == AnimatedTransitionType.pushLeft) { //sourceView if (sourceViewDismiss) { iTween.MoveTo(sourceView.viewContent.gameObject, iTween.Hash("x", -sourceView.viewContent.rect.width, "time", transitionTime, "islocal", true, "oncompletetarget", this.gameObject, "oncomplete", "HideSource")); } //targetView if (targetViewAppear) { targetView.viewContent.localPosition = new Vector3(targetView.viewContent.rect.width, 0, 0); } if (targetViewAppear) { targetView.SetAlpha(1f); } if (targetViewAppear) { targetView.SetVisible(true); } iTween.MoveTo(targetView.viewContent.gameObject, iTween.Hash("x", 0, "time", transitionTime, "islocal", true, "oncompletetarget", this.gameObject, "oncomplete", "TransitionCompleted")); } else if (animatedTransitionType == AnimatedTransitionType.pushRight) { //sourceView if (sourceViewDismiss) { iTween.MoveTo(sourceView.viewContent.gameObject, iTween.Hash("x", sourceView.viewContent.rect.width, "time", transitionTime, "islocal", true, "oncompletetarget", this.gameObject, "oncomplete", "HideSource")); } //targetView if (targetViewAppear) { targetView.viewContent.localPosition = new Vector3(-targetView.viewContent.rect.width, 0, 0); } if (targetViewAppear) { targetView.SetAlpha(1f); } if (targetViewAppear) { targetView.SetVisible(true); } if (targetViewAppear) { iTween.MoveTo(targetView.viewContent.gameObject, iTween.Hash("x", 0, "time", transitionTime, "islocal", true, "oncompletetarget", this.gameObject, "oncomplete", "TransitionCompleted")); } } else if (animatedTransitionType == AnimatedTransitionType.fade) { StartCoroutine(PerformFade()); } } }