Exemplo n.º 1
0
    public List <UIElement> GetAllUIs(bool include_freeze)
    {
        List <UIElement> all_ui_list = new List <UIElement>();

        if (m_root != null)
        {
            Stack <GameObject> stack = new Stack <GameObject>();

            stack.Push(m_root);
            while (stack.Count > 0)
            {
                GameObject cur_go     = stack.Pop();
                UIElement  ui_element = cur_go.GetComponent <UIElement>();

                if (ui_element != null)
                {
                    if (!ui_element.Lock)
                    {
                        GameObject[] children = EditorTool.GetSubChildren(cur_go);

                        for (int i = 0; i < children.Length; ++i)
                        {
                            stack.Push(children[i]);
                        }
                    }
                    if (ui_element.CanEdit && (include_freeze || !ui_element.Freeze) && ui_element.VisbleGolbal)
                    {
                        all_ui_list.Add(ui_element);
                    }
                }
            }
        }

        return(all_ui_list);
    }
Exemplo n.º 2
0
    private void UpdateHierarchyInfo(GameObject root, int nPos)
    {
        UIElement ui = root.GetComponent <UIElement>();

        if (ui != null)
        {
            ui.HierarchyPos = nPos;
            ui.SetRootUIElement(m_root.GetComponent <UIElement>());
            ui.TryFindSubPrefabParent();
            ui.funcSyncUITreeLockForSubPrefab = LayoutEditorWindow.Instance.SyncUITreeLockForSubPrefab;
        }

        GameObject[] child = EditorTool.GetSubChildren(root);
        foreach (GameObject go in child)
        {
            UpdateHierarchyInfo(go, nPos + 1);
        }
    }