protected IEnumerator ShowSubcanvasCoroutine (CanvasController subCC, SubcanvasShowStyle style, object context = null) { CanvasTransitionContext ctContext = new CanvasTransitionContext(this, subCC, context); subCC.CanvasWillShow(ctContext); switch (style) { case SubcanvasShowStyle.Instant: yield return new WaitForEndOfFrame(); subCC.Canvas.enabled = true; subCC.CanvasGroup.alpha = 1; subCC.CanvasDidShow(); break; case SubcanvasShowStyle.FadeIn: subCC.Canvas.enabled = true; CrossFadeCanvasGroup(subCC.CanvasGroup, 1, 0.4f); yield return new WaitForSeconds(0.4f); subCC.CanvasDidShow(); break; } }
private IEnumerator TransitionToCanvasCoroutine (CanvasController cc, CanvasTransitionStyle style, object contextData) { CanvasTransitionContext context = new CanvasTransitionContext(this, cc, contextData); this.CanvasWillHide(); cc.CanvasWillShow(context); switch (style) { case CanvasTransitionStyle.Instant: this.Canvas.enabled = false; this.CanvasGroup.alpha = 0; cc.Canvas.enabled = true; cc.CanvasGroup.alpha = 1; this.CanvasDidHide(); cc.CanvasDidShow(); yield return new WaitForEndOfFrame(); break; case CanvasTransitionStyle.CrossFade: cc.Canvas.enabled = true; CrossFadeCanvasGroup(this.CanvasGroup, 0, 0.4f); CrossFadeCanvasGroup(cc.CanvasGroup, 1, 0.4f); yield return new WaitForSeconds(0.4f); this.CanvasDidHide(); cc.CanvasDidShow(); this.Canvas.enabled = false; break; case CanvasTransitionStyle.SlideUp: yield return new WaitForEndOfFrame(); break; case CanvasTransitionStyle.Scale: yield return new WaitForEndOfFrame(); break; } }