MoveBack() public method

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.
public MoveBack ( ) : bool
return bool
Beispiel #1
0
    public override void OnInput(ref POINTER_INFO ptr)
    {
        if (deleted)
        {
            return;
        }

        if (!m_controlIsEnabled || IsHidden())
        {
            base.OnInput(ref ptr);
            return;
        }

        if (ptr.evt == whenToInvoke)
        {
            if (panelManager == null)
            {
                if (UIPanelManager.instance == null)
                {
                    base.OnInput(ref ptr);
                    return;
                }
                else
                {
                    panelManager = UIPanelManager.instance;
                }

                // If we still have nothing, return:
                if (panelManager == null)
                {
                    base.OnInput(ref ptr);
                    return;
                }
            }


            if (detargetAllOthers)
            {
                UIManager.instance.DetargetAllExcept(ptr.id);
            }


            switch (changeType)
            {
            case ChangeType.BringIn:
                panelManager.BringIn(panel);
                break;

            case ChangeType.BringInImmediate:
                panelManager.BringInImmediate(panel);
                break;

            case ChangeType.BringInForward:
                panelManager.BringIn(panel, UIPanelManager.MENU_DIRECTION.Forwards);
                break;

            case ChangeType.BringInBack:
                panelManager.BringIn(panel, UIPanelManager.MENU_DIRECTION.Backwards);
                break;

            case ChangeType.Dismiss:
                if (panelManager.CurrentPanel != null)
                {
                    if (string.Equals(panelManager.CurrentPanel.name, panel, System.StringComparison.CurrentCultureIgnoreCase))
                    {
                        panelManager.Dismiss(UIPanelManager.MENU_DIRECTION.Forwards);
                    }
                }
                break;

            case ChangeType.DismissCurrent:
                panelManager.Dismiss(UIPanelManager.MENU_DIRECTION.Forwards);
                break;

            case ChangeType.DismissImmediate:
                panelManager.DismissImmediate(UIPanelManager.MENU_DIRECTION.Forwards);
                break;

            case ChangeType.Toggle:
                if (panelManager != null &&
                    panelManager.CurrentPanel != null &&
                    string.Equals(panelManager.CurrentPanel.name, panel, System.StringComparison.CurrentCultureIgnoreCase))
                {
                    panelManager.Dismiss(UIPanelManager.MENU_DIRECTION.Forwards);
                }
                else
                {
                    panelManager.BringIn(panel);
                }
                break;

            case ChangeType.Forward:
                panelManager.MoveForward();
                break;

            case ChangeType.Back:
                panelManager.MoveBack();
                break;
            }
        }

        base.OnInput(ref ptr);
    }