Esempio n. 1
0
    public IOnPanelShow ShowPanel(string panelName, float delay = 0f)
    {
        UIPanel panel = GetPanel(panelName);

        if (panel == null)
        {
            panel = LoadPanel(panelName);
        }

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

            if (!panel.IsActive)
            {
                panel.ClearOnPanelShow();
                _mShowCoroutines[panelName] = this.CallWithDelay(() =>
                {
                    UIManager.ShowUiElement(panel.PanelName);
                    _mShowCoroutines[panelName] = null;
                }, delay);
            }
        }

        return(panel);
    }
Esempio n. 2
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;
        }
    }