Exemple #1
0
        /// <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);
            }
        }
Exemple #2
0
 private void Start()
 {
     // Owner panel should have been added during Awake.
     // If owner is not set yet (this object was added dynamically during run-time), then
     // we need to find the owner manually.
     if (_ownerPanel == null) {
         _ownerPanel = Uzu.Util.FindInParents <UiPanel> (this.gameObject);
         if (_ownerPanel == null) {
             Debug.LogWarning ("UiWidget [" + this.name + "] does not belong to a panel.");
         }
     }
 }
Exemple #3
0
 protected void Awake()
 {
     // Register all child panels.
     MonoBehaviour[] panels = this.gameObject.GetComponentsInChildren <MonoBehaviour> (true);
     for (int i = 0; i < panels.Length; i++)
     {
         UiPanel panel = panels [i] as UiPanel;
         if (panel != null)
         {
             RegisterPanel(panel.gameObject.name, panel);
         }
     }
 }
Exemple #4
0
        private void RegisterPanel(string name, UiPanel panel)
        {
            #if UNITY_EDITOR
            if (_uiPanelDataHolder.ContainsKey(name)) {
                Debug.LogWarning("Panel with name [" + name + "] already exists.");
            }
            #endif // UNITY_EDITOR

            _uiPanelDataHolder [name] = panel;

            // Initialize the panel.
            // Debug.Log("Init: " + panel.name);
            panel.Initialize (this);
        }
Exemple #5
0
 private void Start()
 {
     // Owner panel should have been added during Awake.
     // If owner is not set yet (this object was added dynamically during run-time), then
     // we need to find the owner manually.
     if (_ownerPanel == null)
     {
         _ownerPanel = Uzu.Util.FindInParents <UiPanel> (this.gameObject);
         if (_ownerPanel == null)
         {
             Debug.LogWarning("UiWidget [" + this.name + "] does not belong to a panel.");
         }
     }
 }
Exemple #6
0
        private void RegisterPanel(string name, UiPanel panel)
        {
    #if UNITY_EDITOR
            if (_uiPanelDataHolder.ContainsKey(name))
            {
                Debug.LogWarning("Panel with name [" + name + "] already exists.");
            }
    #endif // UNITY_EDITOR

            _uiPanelDataHolder [name] = panel;

            // Initialize the panel.
            // Debug.Log("Init: " + panel.name);
            panel.Initialize(this);
        }
Exemple #7
0
 /// <summary>
 /// Initialize this widget and set the connection to the owner panel.
 /// </summary>
 public void Initialize(UiPanel ownerPanel)
 {
     _ownerPanel = ownerPanel;
 }
Exemple #8
0
 /// <summary>
 /// Initialize this widget and set the connection to the owner panel.
 /// </summary>
 public void Initialize(UiPanel ownerPanel)
 {
     _ownerPanel = ownerPanel;
 }