/// <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="panelName">Name of 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(string panelName, MENU_DIRECTION dir) { StartCoroutine("Start"); UIPanelBase panel = null; for (int i = 0; i < panels.Count; ++i) { if (string.Equals(panels[i].name, panelName, System.StringComparison.CurrentCultureIgnoreCase)) { panel = panels[i]; break; } } if (panel != null) { BringInImmediate(panel, dir); } }
/// <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) { StartCoroutine("Start"); 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(); } }
/// <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) { StartCoroutine("Start"); 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(); } }
/// <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); }
/// <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="panelIndex">Index of the panel to bring in.</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(int panelIndex, MENU_DIRECTION dir) { StartCoroutine("Start"); for (int i = 0; i < panels.Count; ++i) { if (panels[i].index == panelIndex) { BringInImmediate(panels[i], dir); return; } } Debug.LogWarning("No panel found with index value of " + panelIndex); }
/// <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="panelName">Name of 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(string panelName, MENU_DIRECTION dir) { StartCoroutine("Start"); UIPanelBase panel = null; for (int i = 0; i < panels.Count; ++i) { if (string.Equals(panels[i].name, panelName, System.StringComparison.CurrentCultureIgnoreCase)) { panel = panels[i]; break; } } if (panel != null) BringInImmediate(panel, dir); }
/// <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> /// Brings in the specified panel in a manner /// that portrays the menu moving in the /// specified direction. If "Auto" is specified /// for the direction, forward/backward is /// determined by comparing the index of the /// current panel to the one being brought up. /// </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 BringIn(UIPanelBase panel, MENU_DIRECTION dir) { StartCoroutine("Start"); SHOW_MODE dismissMode; SHOW_MODE bringInMode; if (curPanel == panel) return; // Nothing to do! 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; } dismissMode = ((dir == MENU_DIRECTION.Forwards) ? (SHOW_MODE.DismissForward) : (SHOW_MODE.DismissBack)); bringInMode = ((dir == MENU_DIRECTION.Forwards) ? (SHOW_MODE.BringInForward) : (SHOW_MODE.BringInBack)); // Dismiss the current panel: if (curPanel != null) StartAndTrack(curPanel, dismissMode); // Bring in the next panel: curPanel = panel; breadcrumbs.Add(curPanel); #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 if (deactivateAllButInitialAtStart && !curPanel.gameObject.activeInHierarchy) { curPanel.Start(); curPanel.gameObject.SetActive(true); } #else if (deactivateAllButInitialAtStart && !curPanel.gameObject.active) { curPanel.Start(); curPanel.gameObject.SetActiveRecursively(true); } #endif StartAndTrack(curPanel, bringInMode); }
/// <summary> /// Brings in the specified panel in a manner /// that portrays the menu moving in the /// specified direction. If "Auto" is specified /// for the direction, forward/backward is /// determined by comparing the index of the /// current panel to the one being brought up. /// </summary> /// <param name="panelIndex">Index of the panel to bring in.</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 BringIn(int panelIndex, MENU_DIRECTION dir) { for (int i = 0; i < panels.Count; ++i) { if (panels[i].index == panelIndex) { BringIn(panels[i], dir); return; } } Debug.LogWarning("No panel found with index value of " + panelIndex); }
/// <summary> /// Brings in the specified panel in a manner /// that portrays the menu moving in the /// specified direction. If "Auto" is specified /// for the direction, forward/backward is /// determined by comparing the index of the /// current panel to the one being brought up. /// </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 BringIn(UIPanelBase panel, MENU_DIRECTION dir) { SHOW_MODE dismissMode; SHOW_MODE bringInMode; if (curPanel == panel) return; // Nothing to do! 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; } dismissMode = ( (dir == MENU_DIRECTION.Forwards) ? (SHOW_MODE.DismissForward) : (SHOW_MODE.DismissBack) ); bringInMode = ( (dir == MENU_DIRECTION.Forwards) ? (SHOW_MODE.BringInForward) : (SHOW_MODE.BringInBack) ); // Dismiss the current panel: if (curPanel != null) curPanel.StartTransition(dismissMode); // Bring in the next panel: curPanel = panel; breadcrumbs.Add(curPanel); if (deactivateAllButInitialAtStart && !curPanel.gameObject.active) { curPanel.Start(); curPanel.gameObject.SetActiveRecursively(true); } curPanel.StartTransition(bringInMode); }
/// <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="panelIndex">Index of the panel to bring in.</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(int panelIndex, MENU_DIRECTION dir) { StartCoroutine("Start"); for (int i = 0; i < panels.Count; ++i) { if (panels[i].index == panelIndex) { BringInImmediate(panels[i], dir); return; } } ScreenLog.AddMessage("No panel found with index value of " + panelIndex, ScreenLogType.Warning); }