Ejemplo n.º 1
0
    /// <summary>
    /// 將Panel的資料儲存起來(剛開始的時候會做一次,因為Panel的資料有可能會被動態改變)
    /// </summary>
    public void InitialDefaultSetting()
    {
        UIPanel uiPanel = GetComponent<UIPanel>();
        if (uiPanel == null)
        {
            Debug.LogError("<color=red>Can't find UIPanel component.(name=" + gameObject.name + ")</color>");
            return;
        }
        //Debug.Log("<color=red>InitialDefaultSetting.(Name=" + gameObject.name + ", depth="+ depth + ")</color>");

        _editorDepth = uiPanel.depth;
        _defaultPanelType = PanelType;

        UIPanel[] uiPanelList = GetComponentsInChildren<UIPanel>(true);
        if (uiPanelList == null)
        {
            Debug.Log("<color=red>Initial panel default setting is fail.</color>");
            return;
        }

        foreach (UIPanel panel in uiPanelList)
        {
            if (panel.gameObject == gameObject)
                continue;

            ChildPanelInfo info = new ChildPanelInfo();
            info.EditorDepth = panel.depth;
            info.UIPanel = panel;

            _childPanelInfoList.Add(info);
        }

        _childPanelInfoList.Sort(SortChildPanel);
    }
Ejemplo n.º 2
0
 private int SortChildPanel(ChildPanelInfo lhs, ChildPanelInfo rhs)
 {
     return lhs.EditorDepth.CompareTo(rhs.EditorDepth);
 }