示例#1
0
        /// <summary>
        /// Changes the current panel to the specified panel id.
        /// </summary>
        public void ChangeCurrentPanel(string panelId)
        {
            UiPanelInterface panel;

            if (_uiPanelDataHolder.TryGetValue(panelId, out panel))
            {
                UiPanelInterface prevPanel = _currentPanel;

                if (prevPanel != null)
                {
                    prevPanel.Deactivate();
                }

                _currentPanel   = panel;
                _currentPanelId = panelId;
                _currentPanel.Activate();

                // Trigger callback.
                {
                    if (OnPanelChange != null)
                    {
                        PanelChangeContext context = new PanelChangeContext();
                        context.PreviousPanel = prevPanel;
                        context.CurrentPanel  = _currentPanel;
                        OnPanelChange(context);
                    }
                }
            }
            else
            {
                Debug.LogError("Unable to activate a panel that is not registered: " + panelId);
            }
        }
示例#2
0
        /// <summary>
        /// Changes the current panel to the specified panel id.
        /// </summary>
        public void ChangeCurrentPanel(string panelId)
        {
            UiPanelInterface panel;
            if (_uiPanelDataHolder.TryGetValue (panelId, out panel)) {
                UiPanelInterface prevPanel = _currentPanel;

                if (prevPanel != null) {
                    prevPanel.Deactivate ();
                }

                _currentPanel = panel;
                _currentPanelId = panelId;
                _currentPanel.Activate ();

                // Trigger callback.
                {
                    if (OnPanelChange != null) {
                        PanelChangeContext context = new PanelChangeContext();
                        context.PreviousPanel = prevPanel;
                        context.CurrentPanel = _currentPanel;
                        OnPanelChange(context);
                    }
                }
            } else {
                Debug.LogError ("Unable to activate a panel that is not registered: " + panelId);
            }
        }