StartTransition() public method

Starts one of the panel's "bring in" or "dismiss" transitions.
public StartTransition ( UIPanelManager, mode ) : void
mode UIPanelManager, The mode corresponding to the transition that should be played.
return void
    // 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;
        }
    }
Example #2
0
    /// <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);
    }
Example #3
0
    public override void OnInput(ref POINTER_INFO ptr)
    {
        if (deleted)
        {
            return;
        }

        base.OnInput(ref ptr);

        if (!m_controlIsEnabled || IsHidden())
        {
            return;
        }

        if (ptr.evt == whenToInvoke)
        {
            if (loadingPanel != null)
            {
                UIPanelManager mgr = (UIPanelManager)loadingPanel.Container;

                // Let us know when the panel is finished coming in:
                loadingPanel.AddTempTransitionDelegate(LoadSceneDelegate);

                if (mgr is UIPanelManager && mgr != null)
                {
                    mgr.BringIn(loadingPanel);
                }
                else
                {
                    loadingPanel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);
                }
            }
            else
            {
                Invoke("DoLoadScene", delay);
            }
        }
    }
Example #4
0
    public override void OnInput(ref POINTER_INFO ptr)
    {
        if (deleted)
        {
            return;
        }

        base.OnInput(ref ptr);

        if (!m_controlIsEnabled || IsHidden())
        {
            return;
        }

        if (panel == null)
        {
            return;
        }

        if (ptr.evt == whenToInvoke)
        {
            if (toggle)
            {
                if (panelManager != null)
                {
                    if (panelManager.CurrentPanel == panel)
                    {
                        panelManager.Dismiss(UIPanelManager.MENU_DIRECTION.Forwards);
                        panelIsShowing = false;
                    }
                    else
                    {
                        panelManager.BringIn(panel);
                        panelIsShowing = true;
                    }
                }
                else
                {
                    if (panelIsShowing)
                    {
                        panel.StartTransition(UIPanelManager.SHOW_MODE.DismissForward);
                    }
                    else
                    {
                        panel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);
                    }

                    panelIsShowing = !panelIsShowing;
                }

                Value = panelIsShowing;
            }
            else
            {
                if (panelManager != null)
                {
                    panelManager.BringIn(panel, UIPanelManager.MENU_DIRECTION.Forwards);
                }
                else
                {
                    panel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);
                }
            }
        }
    }
	// 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>
	/// 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>
	/// Moves the menu back to the previous panel
	/// in the sequence (determined by panel 
	/// index).  Automatically dismisses the
	/// currently displaying panel using the 
	/// "back" mode.
	/// </summary>
	/// <returns>True if the there are more panels 
	/// before this one. False if this is the first 
	/// panel, or if the menu was already at the 
	/// beginning.</returns>
	public bool MoveBack()
	{
		// If this isn't a linear menu, use our history
		// to go backward:
		if (!linearNavigation)
		{
			// See if we're at the beginning:
			if (breadcrumbs.Count <= 1)
			{
				if (advancePastEnd)
				{
					// Send away the current panel:
					if (curPanel != null)
						curPanel.StartTransition(SHOW_MODE.DismissBack);

					curPanel = null;

					// Don't add more than one null on the stack:
					if (breadcrumbs.Count > 0)
					{
						if (breadcrumbs[breadcrumbs.Count - 1] != null)
							breadcrumbs.Add(null);
					}
					else
						breadcrumbs.Add(null);
				}
				return false; // We're at the beginning
			}

			// Go back in our history:
			if (breadcrumbs.Count != 0)
				breadcrumbs.RemoveAt(breadcrumbs.Count-1);


			// Send away the current panel:
			if (curPanel != null)
				curPanel.StartTransition(SHOW_MODE.DismissBack);

			// Bring in the previous panel:
			if(breadcrumbs.Count > 0)
				curPanel = breadcrumbs[breadcrumbs.Count-1];
			if (curPanel != null)
			{
				if (deactivateAllButInitialAtStart && !curPanel.gameObject.active)
				{
					curPanel.Start();
					curPanel.gameObject.SetActiveRecursively(true);
				}

				curPanel.StartTransition(SHOW_MODE.BringInBack);
			}

			// Return false if we've reached the beginning:
			if (breadcrumbs.Count <= 1)
				return false;
			else
				return true;
		}
		else // Else this is a linear menu, so just go back to the previous panel in our array
		{
			int index = panels.IndexOf(curPanel);

			// If we're at the first index:
			if (index <= 0)
			{
				if(!circular)
				{
					if(advancePastEnd)
					{
						// Send away the current panel:
						if (curPanel != null)
							curPanel.StartTransition(SHOW_MODE.DismissBack);

						curPanel = null;
					}
					return false; // We're already at the beginning
				}
				else
				{
					// Wrap back to the end:
					index = panels.Count;
				}
			}

			// Send away the current panel:
			if (curPanel != null)
				curPanel.StartTransition(SHOW_MODE.DismissBack);

			// Bring in the previous panel:
			--index;
			curPanel = panels[index];

			if (deactivateAllButInitialAtStart && !curPanel.gameObject.active)
			{
				curPanel.Start();
				curPanel.gameObject.SetActiveRecursively(true);
			}

			curPanel.StartTransition(SHOW_MODE.BringInBack);

			if (index <= 0 && !circular)
				return false;
			else
				return true;
		}
	}
	/// <summary>
	/// Moves the menu forward to the next panel
	/// in the sequence (determined by panel 
	/// index).  Automatically dismisses the
	/// currently displaying panel using the 
	/// forward mode.
	/// </summary>
	/// <returns>True if the there are more panels 
	/// after this one. False if this is the last 
	/// panel, or if the menu was already at the end.</returns>
	public bool MoveForward()
	{
		int index = panels.IndexOf(curPanel);

		if (index >= panels.Count - 1)
		{
			// See if we should wrap to the beginning:
			if (!circular)
			{
				// See if we should advance past the end:
				if (advancePastEnd)
				{
					// Send away the current panel:
					if (curPanel != null)
						curPanel.StartTransition(SHOW_MODE.DismissForward);

					curPanel = null;

					// Don't add more than one null on the stack:
					if(breadcrumbs.Count > 0)
					{
						if (breadcrumbs[breadcrumbs.Count - 1] != null)
							breadcrumbs.Add(null);
					}
					else
						breadcrumbs.Add(null);
				}
				return false; // We're already at the end
			}
			else
				index = -1; // Wrap back to the beginning
		}

		// Send away the current panel:
		if (curPanel != null)
			curPanel.StartTransition(SHOW_MODE.DismissForward);

		// Bring in the next panel:
		++index;
		curPanel = panels[index];
		breadcrumbs.Add(curPanel);

		if (deactivateAllButInitialAtStart && !curPanel.gameObject.active)
		{
			curPanel.Start();
			curPanel.gameObject.SetActiveRecursively(true);
		}

		curPanel.StartTransition(SHOW_MODE.BringInForward);

		if (index >= panels.Count - 1 && !circular)
			return false;
		else
			return true;
	}
Example #9
0
    /// <summary>
    /// Moves the menu back to the previous panel
    /// in the sequence (determined by panel
    /// index).  Automatically dismisses the
    /// currently displaying panel using the
    /// "back" mode.
    /// </summary>
    /// <returns>True if the there are more panels
    /// before this one. False if this is the first
    /// panel, or if the menu was already at the
    /// beginning.</returns>
    public bool MoveBack()
    {
        // If this isn't a linear menu, use our history
        // to go backward:
        if (!linearNavigation)
        {
            // See if we're at the beginning:
            if (breadcrumbs.Count <= 1)
            {
                if (advancePastEnd)
                {
                    // Send away the current panel:
                    if (curPanel != null)
                    {
                        curPanel.StartTransition(SHOW_MODE.DismissBack);
                    }

                    curPanel = null;

                    // Don't add more than one null on the stack:
                    if (breadcrumbs.Count > 0)
                    {
                        if (breadcrumbs[breadcrumbs.Count - 1] != null)
                        {
                            breadcrumbs.Add(null);
                        }
                    }
                    else
                    {
                        breadcrumbs.Add(null);
                    }
                }
                return(false);                // We're at the beginning
            }

            // Go back in our history:
            if (breadcrumbs.Count != 0)
            {
                breadcrumbs.RemoveAt(breadcrumbs.Count - 1);
            }


            // Send away the current panel:
            if (curPanel != null)
            {
                curPanel.StartTransition(SHOW_MODE.DismissBack);
            }

            // Bring in the previous panel:
            if (breadcrumbs.Count > 0)
            {
                curPanel = breadcrumbs[breadcrumbs.Count - 1];
            }
            if (curPanel != null)
            {
                if (deactivateAllButInitialAtStart && !curPanel.gameObject.active)
                {
                    curPanel.Start();
                    curPanel.gameObject.SetActiveRecursively(true);
                }

                curPanel.StartTransition(SHOW_MODE.BringInBack);
            }

            // Return false if we've reached the beginning:
            if (breadcrumbs.Count <= 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        else         // Else this is a linear menu, so just go back to the previous panel in our array
        {
            int index = panels.IndexOf(curPanel);

            // If we're at the first index:
            if (index <= 0)
            {
                if (!circular)
                {
                    if (advancePastEnd)
                    {
                        // Send away the current panel:
                        if (curPanel != null)
                        {
                            curPanel.StartTransition(SHOW_MODE.DismissBack);
                        }

                        curPanel = null;
                    }
                    return(false);                    // We're already at the beginning
                }
                else
                {
                    // Wrap back to the end:
                    index = panels.Count;
                }
            }

            // Send away the current panel:
            if (curPanel != null)
            {
                curPanel.StartTransition(SHOW_MODE.DismissBack);
            }

            // Bring in the previous panel:
            --index;
            curPanel = panels[index];

            if (deactivateAllButInitialAtStart && !curPanel.gameObject.active)
            {
                curPanel.Start();
                curPanel.gameObject.SetActiveRecursively(true);
            }

            curPanel.StartTransition(SHOW_MODE.BringInBack);

            if (index <= 0 && !circular)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
    }
Example #10
0
    /// <summary>
    /// Moves the menu forward to the next panel
    /// in the sequence (determined by panel
    /// index).  Automatically dismisses the
    /// currently displaying panel using the
    /// forward mode.
    /// </summary>
    /// <returns>True if the there are more panels
    /// after this one. False if this is the last
    /// panel, or if the menu was already at the end.</returns>
    public bool MoveForward()
    {
        int index = panels.IndexOf(curPanel);

        if (index >= panels.Count - 1)
        {
            // See if we should wrap to the beginning:
            if (!circular)
            {
                // See if we should advance past the end:
                if (advancePastEnd)
                {
                    // Send away the current panel:
                    if (curPanel != null)
                    {
                        curPanel.StartTransition(SHOW_MODE.DismissForward);
                    }

                    curPanel = null;

                    // Don't add more than one null on the stack:
                    if (breadcrumbs.Count > 0)
                    {
                        if (breadcrumbs[breadcrumbs.Count - 1] != null)
                        {
                            breadcrumbs.Add(null);
                        }
                    }
                    else
                    {
                        breadcrumbs.Add(null);
                    }
                }
                return(false);                // We're already at the end
            }
            else
            {
                index = -1;                 // Wrap back to the beginning
            }
        }

        // Send away the current panel:
        if (curPanel != null)
        {
            curPanel.StartTransition(SHOW_MODE.DismissForward);
        }

        // Bring in the next panel:
        ++index;
        curPanel = panels[index];
        breadcrumbs.Add(curPanel);

        if (deactivateAllButInitialAtStart && !curPanel.gameObject.active)
        {
            curPanel.Start();
            curPanel.gameObject.SetActiveRecursively(true);
        }

        curPanel.StartTransition(SHOW_MODE.BringInForward);

        if (index >= panels.Count - 1 && !circular)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }