示例#1
0
    private void StopOngoingCoroutines(UIPanel panel)
    {
        Coroutine hideCoroutine = null;

        _mHideCoroutines.TryGetValue(panel.PanelName, out hideCoroutine);
        if (hideCoroutine != null)
        {
            panel.ClearOnPanelHide();
            StopCoroutine(hideCoroutine);
            _mHideCoroutines[panel.PanelName] = null;
        }

        Coroutine showCoroutine = null;

        _mShowCoroutines.TryGetValue(panel.PanelName, out showCoroutine);
        if (showCoroutine != null)
        {
            panel.ClearOnPanelShow();
            StopCoroutine(showCoroutine);
            _mShowCoroutines[panel.PanelName] = null;
        }
    }
示例#2
0
    public IOnPanelHide HidePanel(string panelName, float delay = 0f)
    {
        UIPanel panel = GetPanel(panelName);

        if (panel != null)
        {
            StopOngoingCoroutines(panel);

            if (panel.IsActive)
            {
                panel.ClearOnPanelHide();

                _mHideCoroutines[panelName] = this.CallWithDelay(() =>
                {
                    UIManager.HideUiElement(panel.PanelName);
                    _mHideCoroutines[panelName] = null;
                }, delay);
            }
        }

        return(panel);
    }