public void Set(int index) { screens[index].transform.SetAsLastSibling(); screens[index].Show(currentScreen); lastScreen = currentScreen; currentScreen = screens[index]; }
public void Back() { lastScreen.ShowWithoutTransition(); currentScreen.Hide(); ScreenConfig temp = currentScreen; currentScreen = lastScreen; lastScreen = temp; }
/// <summary> /// Set active screen /// </summary> /// <param name="screen"></param> private void SetScreen(ScreenConfig screen) { if (screen == null) { return; } screen.transform.SetAsLastSibling(); screen.Show(currentScreen); SetCurrentScreen(screen); }
public void Set(ScreenConfig screen) { for (int i = 0; i < screens.Length; i++) { if (screens[i] == screen) { Set(i); return; } } }
public void Set(int index) { // Prevent transitions on screens that are already in the process of transitioning in or out. if (currentScreen && currentScreen.CurrentState != ScreenConfig.AnimationState.Stationary) { return; } screens[index].transform.SetAsLastSibling(); screens[index].Show(currentScreen); lastScreen = currentScreen; currentScreen = screens[index]; }
public void Set(int index) { if (index == 7) { graphrenderer.SetActive(true); } else if (index == 17) { graphrenderer.SetActive(true); } else { graphrenderer.SetActive(false); audioSource.Stop(); //avatar.transform.position = Vector3.one * 1000; } if (index == 2 || index == 3) { avatrCam.SetActive(true); } else { avatrCam.SetActive(false); } //if(index==3&&!Choice) //{ // patientJournalScreen._TrackerType = TrackerManager.TrackerType.CSU; // Choice = true; //} //else if(index==2 && !Choice) //{ // patientJournalScreen._TrackerType = TrackerManager.TrackerType.Symptom; // Choice = true; //} //else if(index==6) //{ // patientJournalScreen._TrackerType = TrackerManager.TrackerType.Symptom; //} //else if(index==5) //{ // patientJournalScreen._TrackerType = TrackerManager.TrackerType.Asthma; //} screens[index].transform.SetAsLastSibling(); screens[index].Show(currentScreen); lastScreen = currentScreen; currentScreen = screens[index]; }
public void Back() { int index = Array.IndexOf(screens, lastScreen); Set(index); // TODO - this doesn't work return; lastScreen.ShowWithoutTransition(); currentScreen.Hide(); ScreenConfig temp = currentScreen; currentScreen = lastScreen; lastScreen = temp; }
/// <summary> /// Set current screen variable /// </summary> /// <param name="screen"></param> private void SetCurrentScreen(ScreenConfig screen) { if (currentScreen != null && currentScreen.associatedMenu != null) { currentScreen.associatedMenu.UnsetActive(); } currentScreen = screen; if (currentScreen == homeScreen) { ClearLastScreens(); } if (currentScreen.associatedMenu != null) { currentScreen.associatedMenu.SetActive(); } }
private void SetLastScreen(ScreenConfig screen) { lastScreens.Push(screen); }
public void Update() { animDeltaTime = Time.realtimeSinceStartup - animStartTime; if (state == AnimationState.TransitioningIn) { if (animDeltaTime <= animationDuration) { if (transitionInType == TransitionType.RippleMask) { tempVector2 = currentRipple.sizeDelta; tempVector2.x = Anim.Quint.In(0f, rippleSize, animDeltaTime, animationDuration); tempVector2.y = tempVector2.x; currentRipple.sizeDelta = tempVector2; theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, thisScreenSize.x); theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, thisScreenSize.y); } else { if (slideIn != SlideDirection.None) { tempVector2 = theRectTransform.anchoredPosition; tempVector2.x = Anim.Quint.Out(slideInDirectionPosition.x, 0f, animDeltaTime, animationDuration); tempVector2.y = Anim.Quint.Out(slideInDirectionPosition.y, 0f, animDeltaTime, animationDuration); theRectTransform.anchoredPosition = tempVector2; } if (scaleIn) { tempVector3 = theRectTransform.localScale; tempVector3.x = Anim.Quint.Out(scaleInStartValue, 1f, animDeltaTime, animationDuration); tempVector3.y = Anim.Quint.Out(scaleInStartValue, 1f, animDeltaTime, animationDuration); theRectTransform.localScale = tempVector3; } if (fadeIn) { theCanvasGroup.alpha = Anim.Quint.Out(fadeInStartValue, 1f, animDeltaTime, animationDuration); } } } else { if (transitionInType == TransitionType.RippleMask) { theRectTransform.SetParent(transform); theRectTransform.position = screenSpacePosition; theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, thisScreenSize.x); theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, thisScreenSize.y); } else { if (slideIn != SlideDirection.None) { theRectTransform.anchoredPosition = new Vector2(0f, 0f); } if (scaleIn) { theRectTransform.localScale = new Vector3(1f, 1f, 1f); } if (fadeIn) { theCanvasGroup.alpha = 1f; } } if (hideScreen && hideScreen != this) { hideScreen.HideWithoutTransition(); hideScreen = null; } state = AnimationState.Stationary; if (TransitionInComplete != null) { TransitionInComplete(this, new EventArgs()); } } } else if (state == AnimationState.TransitioningOut) { if (animDeltaTime <= animationDuration) { if (transitionInType == TransitionType.RippleMask) { tempVector2 = currentRipple.sizeDelta; tempVector2.x = Anim.Quint.In(rippleSize, 0f, animDeltaTime, animationDuration); tempVector2.y = tempVector2.x; currentRipple.sizeDelta = tempVector2; theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, thisScreenSize.x); theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, thisScreenSize.y); } else { if (slideOut != SlideDirection.None) { tempVector2 = theRectTransform.anchoredPosition; tempVector2.x = Anim.Quint.Out(0f, slideOutDirectionPosition.x, animDeltaTime, animationDuration); tempVector2.y = Anim.Quint.Out(0f, slideOutDirectionPosition.y, animDeltaTime, animationDuration); theRectTransform.anchoredPosition = tempVector2; } if (scaleOut) { tempVector3 = theRectTransform.localScale; tempVector3.x = Anim.Quint.Out(1f, scaleOutEndValue, animDeltaTime, animationDuration); tempVector3.y = Anim.Quint.Out(1f, scaleOutEndValue, animDeltaTime, animationDuration); theRectTransform.localScale = tempVector3; } if (fadeOut) { theCanvasGroup.alpha = Anim.Quint.Out(1f, fadeOutEndValue, animDeltaTime, animationDuration); } } } else { currentRipple.gameObject.SetActive(false); theRectTransform.SetParent(transform); theRectTransform.position = screenSpacePosition; screenSpace.SetActive(false); state = AnimationState.Stationary; } } }
void Update() { animDeltaTime = Time.realtimeSinceStartup - animStartTime; if (state == 1) { if (animDeltaTime <= animationDuration) { if (transitionInType == TransitionType.RippleMask) { tempVector2 = currentRipple.sizeDelta; tempVector2.x = Anim.Quint.In(0f, rippleSize, animDeltaTime, animationDuration); tempVector2.y = tempVector2.x; currentRipple.sizeDelta = tempVector2; theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, thisScreenSize.x); theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, thisScreenSize.y); } else { if (slideIn != SlideDirection.None) { tempVector2 = theRectTransform.anchoredPosition; tempVector2.x = Anim.Quint.Out(slideInDirectionPosition.x, 0f, animDeltaTime, animationDuration); tempVector2.y = Anim.Quint.Out(slideInDirectionPosition.y, 0f, animDeltaTime, animationDuration); theRectTransform.anchoredPosition = tempVector2; } if (scaleIn) { tempVector3 = theRectTransform.localScale; tempVector3.x = Anim.Quint.Out(scaleInStartValue, 1f, animDeltaTime, animationDuration); tempVector3.y = Anim.Quint.Out(scaleInStartValue, 1f, animDeltaTime, animationDuration); theRectTransform.localScale = tempVector3; } if (fadeIn) { theCanvasGroup.alpha = Anim.Quint.Out(fadeInStartValue, 1f, animDeltaTime, animationDuration); } } } else { if (transitionInType == TransitionType.RippleMask) { theRectTransform.SetParent(transform); theRectTransform.position = screenSpacePosition; theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, thisScreenSize.x); theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, thisScreenSize.y); } else { if (slideIn != SlideDirection.None) { theRectTransform.anchoredPosition = new Vector2(0f, 0f); } if (scaleIn) { theRectTransform.localScale = new Vector3(1f, 1f, 1f); } if (fadeIn) { theCanvasGroup.alpha = 1f; } } if (hideScreen && hideScreen != this) { hideScreen.HideWithoutTransition(); hideScreen = null; } state = 0; } } else if (state == 2) { if (animDeltaTime <= animationDuration) { if (transitionInType == TransitionType.RippleMask) { tempVector2 = currentRipple.sizeDelta; tempVector2.x = Anim.Quint.In(rippleSize, 0f, animDeltaTime, animationDuration); tempVector2.y = tempVector2.x; currentRipple.sizeDelta = tempVector2; theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, thisScreenSize.x); theRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, thisScreenSize.y); } else { if (slideOut != SlideDirection.None) { tempVector2 = theRectTransform.anchoredPosition; tempVector2.x = Anim.Quint.Out(0f, slideOutDirectionPosition.x, animDeltaTime, animationDuration); tempVector2.y = Anim.Quint.Out(0f, slideOutDirectionPosition.y, animDeltaTime, animationDuration); theRectTransform.anchoredPosition = tempVector2; } if (scaleOut) { tempVector3 = theRectTransform.localScale; tempVector3.x = Anim.Quint.Out(1f, scaleOutEndValue, animDeltaTime, animationDuration); tempVector3.y = Anim.Quint.Out(1f, scaleOutEndValue, animDeltaTime, animationDuration); theRectTransform.localScale = tempVector3; } if (fadeOut) { theCanvasGroup.alpha = Anim.Quint.Out(1f, fadeOutEndValue, animDeltaTime, animationDuration); } } } else { theRectTransform.SetParent(transform); theRectTransform.position = screenSpacePosition; screenSpace.SetActive(false); state = 0; } } }
public void Show(ScreenConfig screenToHide) { hideScreen = screenToHide; Show(); }
void OnEnable() { screenConfig = (ScreenConfig)target; }
void Update() { animDeltaTime = Time.realtimeSinceStartup - animStartTime; if (state == 1) { if (animDeltaTime <= animationDuration) { if (transitionInType == TransitionType.RippleMask) { tempVector2 = currentRipple.sizeDelta; tempVector2.x = Anim.Quint.In(0f, rippleSize, animDeltaTime, animationDuration); tempVector2.y = tempVector2.x; currentRipple.sizeDelta = tempVector2; } else { if (slideIn != SlideDirection.None) { tempVector2 = theRectTransform.anchoredPosition; tempVector2.x = Anim.Quint.Out(slideInDirectionPosition.x, 0f, animDeltaTime, animationDuration); tempVector2.y = Anim.Quint.Out(slideInDirectionPosition.y, 0f, animDeltaTime, animationDuration); theRectTransform.anchoredPosition = tempVector2; } if (scaleIn) { tempVector3 = theRectTransform.localScale; tempVector3.x = Anim.Quint.Out(scaleInStartValue, 1f, animDeltaTime, animationDuration); tempVector3.y = Anim.Quint.Out(scaleInStartValue, 1f, animDeltaTime, animationDuration); theRectTransform.localScale = tempVector3; } if (fadeIn) { theCanvasGroup.alpha = Anim.Quint.Out(fadeInStartValue, 1f, animDeltaTime, animationDuration); } } } else { if (transitionInType == TransitionType.RippleMask) { theRectTransform.SetParent(transform); theRectTransform.position = screenSpacePosition; } else { if (slideIn != SlideDirection.None) { theRectTransform.anchoredPosition = new Vector2(0f, 0f); } if (scaleIn) { theRectTransform.localScale = new Vector3(1f, 1f, 1f); } if (fadeIn) { theCanvasGroup.alpha = 1f; } } if (hideScreen && hideScreen != this) { hideScreen.HideWithoutTransition(); hideScreen = null; } state = 0; } } else if (state == 2) { if (animDeltaTime <= animationDuration) { if (transitionInType == TransitionType.RippleMask) { tempVector2 = currentRipple.sizeDelta; tempVector2.x = Anim.Quint.In(rippleSize, 0f, animDeltaTime, animationDuration); tempVector2.y = tempVector2.x; currentRipple.sizeDelta = tempVector2; } else { if (slideOut != SlideDirection.None) { tempVector2 = theRectTransform.anchoredPosition; tempVector2.x = Anim.Quint.Out(0f, slideOutDirectionPosition.x, animDeltaTime, animationDuration); tempVector2.y = Anim.Quint.Out(0f, slideOutDirectionPosition.y, animDeltaTime, animationDuration); theRectTransform.anchoredPosition = tempVector2; } if (scaleOut) { tempVector3 = theRectTransform.localScale; tempVector3.x = Anim.Quint.Out(1f, scaleOutEndValue, animDeltaTime, animationDuration); tempVector3.y = Anim.Quint.Out(1f, scaleOutEndValue, animDeltaTime, animationDuration); theRectTransform.localScale = tempVector3; } if (fadeOut) { theCanvasGroup.alpha = Anim.Quint.Out(1f, fadeOutEndValue, animDeltaTime, animationDuration); } } } else { theRectTransform.SetParent(transform); theRectTransform.position = screenSpacePosition; screenSpace.SetActive(false); state = 0; } } }
void Start() { lastScreen = screens [0]; currentScreen = screens [0]; }
public void Show(ScreenConfig screenToHide) { previousScreen = screenToHide; Show(); }