/// <summary> /// Changes the current panel to the specified panel id. /// </summary> public void ChangeCurrentPanel(string panelId) { UiPanel panel; if (_uiPanelDataHolder.TryGetValue (panelId, out panel)) { { UiPanel prevPanel = _currentPanel; if (prevPanel != null) { PanelExitContext context = new PanelExitContext(); // Debug.Log("Exit: " + prevPanel.name); prevPanel.OnExit (context); } } { PanelEnterContext context = new PanelEnterContext(); _currentPanel = panel; _currentPanelId = panelId; // Debug.Log("Enter: " + _currentPanel.name); _currentPanel.OnEnter (context); } } else { Debug.LogError ("Unable to activate a panel that is not registered: " + panelId); } }