/// <summary> /// Dismisses the currently showing panel, if any, /// in the direction specified. /// </summary> /// <param name="dir">The direction in which the panel is to be dismissed.</param> public void Dismiss(MENU_DIRECTION dir) { StartCoroutine("Start"); if (dir == MENU_DIRECTION.Auto) { dir = MENU_DIRECTION.Backwards; } SHOW_MODE mode = ((dir == MENU_DIRECTION.Forwards) ? (SHOW_MODE.DismissForward) : (SHOW_MODE.DismissBack)); if (curPanel != null) { StartAndTrack(curPanel, mode); } curPanel = null; // Only push on a null ref if there // isn't already one on the stack: if (breadcrumbs.Count > 0) { if (breadcrumbs[breadcrumbs.Count - 1] != null) { breadcrumbs.Add(null); } } }
// Starts a panel transitioning and tracks it protected void StartAndTrack(UIPanelBase p, SHOW_MODE mode) { p.StartTransition(mode); // See if it didn't quit immediately: if (p.IsTransitioning) { p.AddTempTransitionDelegate(DecrementTransitioningPanels); ++transitioningPanelCount; } }
/// <summary> /// Same as BringIn(...), but skips the panel's transition, fast-forwarding /// it instantly to its end state. See the corresponding BringIn() entry for more details. /// </summary> /// <param name="panel">Reference to the panel to bring up.</param> /// <param name="dir">Direction the menu should appear to be moving. /// If "Auto" is specified, the direction is determined by comparing /// the index of the current panel to the one being brought up.</param> public void BringInImmediate(UIPanelBase panel, MENU_DIRECTION dir) { StartCoroutine("Start"); UIPanelBase prevPanel = curPanel; EZTransition trans; // Get the transition directions: if (dir == MENU_DIRECTION.Auto) { // See if we can determine the direction: if (curPanel != null) { // Forward if (curPanel.index <= panel.index) { dir = MENU_DIRECTION.Forwards; } else // Backward { dir = MENU_DIRECTION.Backwards; } } else // Assume forward: { dir = MENU_DIRECTION.Forwards; } } SHOW_MODE dismissMode = ((dir == MENU_DIRECTION.Forwards) ? (SHOW_MODE.DismissForward) : (SHOW_MODE.DismissBack)); SHOW_MODE bringInMode = ((dir == MENU_DIRECTION.Forwards) ? (SHOW_MODE.BringInForward) : (SHOW_MODE.BringInBack)); // Do the bring-in: BringIn(panel, dir); // End the transitions early: if (prevPanel != null) { trans = prevPanel.GetTransition(dismissMode); trans.End(); } if (curPanel != null) { trans = curPanel.GetTransition(bringInMode); trans.End(); } }
/// <summary> /// Same as Dismiss(...), but skips the panel's transition, fast-forwarding /// it instantly to its end state. See the corresponding Dismiss() entry for more details. /// </summary> /// <param name="dir">The direction in which the panel is to be dismissed.</param> public void DismissImmediate(MENU_DIRECTION dir) { if (dir == MENU_DIRECTION.Auto) { dir = MENU_DIRECTION.Backwards; } SHOW_MODE mode = ((dir == MENU_DIRECTION.Forwards) ? (SHOW_MODE.DismissForward) : (SHOW_MODE.DismissBack)); UIPanelBase prevPanel = curPanel; Dismiss(dir); if (prevPanel != null) { prevPanel.GetTransition(mode).End(); } }
public void ChangeToggle(SHOW_MODE show_mode) { showMode = show_mode; ShowSelectUI(); }