示例#1
0
        public void DrawSceneTree()
        {
            var gameObjects = sceneRoots.Keys.ToArray();

            if (MainWindow.Instance.Config.SortItemsAlphabetically)
            {
                Array.Sort(gameObjects, (x, y) => string.CompareOrdinal(x?.name, y?.name));
            }

            if (!sceneTreeArea.Begin())
            {
                return;
            }

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Refresh", GUILayout.ExpandWidth(false)))
            {
                RefreshSceneRoots();
            }

            if (GUILayout.Button("Fold all / Clear", GUILayout.ExpandWidth(false)))
            {
                ClearExpanded();
                RefreshSceneRoots();
                ClearHistory();
            }

            GUILayout.EndHorizontal();

            if (ToolManager.exists && ToolManager.instance?.m_properties?.CurrentTool != null)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Show current tool", GUILayout.ExpandWidth(false)))
                {
                    Show(ReferenceChainBuilder.ForCurrentTool());
                }

                GUILayout.EndHorizontal();
            }

            if (ToolManager.exists && ToolManager.instance?.m_properties?.m_editPrefabInfo != null)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Show edited prefab", GUILayout.ExpandWidth(false)))
                {
                    Show(ReferenceChainBuilder.ForEditPrefabInfo());
                }

                GUILayout.EndHorizontal();
            }

            if (!string.IsNullOrEmpty(searchDisplayString))
            {
                GUI.contentColor = Color.green;
                GUILayout.Label(searchDisplayString);
                GUI.contentColor = Color.white;
            }

            sceneTreeScrollPosition = GUILayout.BeginScrollView(sceneTreeScrollPosition);

            foreach (var obj in gameObjects)
            {
                GUIRecursiveTree.OnSceneTreeRecursive(gameObject, state, new ReferenceChain().Add(obj), obj);
            }

            GUILayout.EndScrollView();

            sceneTreeArea.End();
        }