コード例 #1
0
        // Draw the results found for this container
        public void DrawOnGUI(SearchResultDrawParameters parameters)
        {
            Color c = GUI.color;

            GUI.color = Color.cyan;

            if (GUILayout.Button(title, Utilities.BoxGUIStyle, Utilities.GL_EXPAND_WIDTH, Utilities.GL_HEIGHT_40) && clickable)
            {
                // If the container (scene, usually) is clicked, highlight it on Project view
                AssetDatabase.LoadAssetAtPath <SceneAsset>(title).SelectInEditor();
            }

            GUI.color = Color.yellow;

            if (parameters.pathDrawingMode == PathDrawingMode.Full)
            {
                for (int i = 0; i < references.Count; i++)
                {
                    GUILayout.Space(5);
                    references[i].DrawOnGUIRecursively(parameters, null);
                }
            }
            else
            {
                if (referencePathsShortUnique == null)
                {
                    CalculateShortestPathsToReferences();
                }

                List <ReferencePath> pathsToDraw;
                if (parameters.pathDrawingMode == PathDrawingMode.ShortRelevantParts)
                {
                    pathsToDraw = referencePathsShortUnique;
                }
                else
                {
                    pathsToDraw = referencePathsShortest;
                }

                for (int i = 0; i < pathsToDraw.Count; i++)
                {
                    GUILayout.Space(5);

                    GUILayout.BeginHorizontal();

                    ReferencePath path = pathsToDraw[i];
                    path.startNode.DrawOnGUI(parameters, null);

                    ReferenceNode currentNode = path.startNode;
                    for (int j = 0; j < path.pathLinksToFollow.Length; j++)
                    {
                        ReferenceNode.Link link = currentNode[path.pathLinksToFollow[j]];
                        link.targetNode.DrawOnGUI(parameters, link.description);
                        currentNode = link.targetNode;
                    }

                    GUILayout.EndHorizontal();
                }
            }

            GUI.color = c;

            GUILayout.Space(10);
        }
コード例 #2
0
        // Draw the results found for this container
        public void DrawOnGUI(SearchResultDrawParameters parameters)
        {
            Color c = GUI.color;

            GUI.color = Color.cyan;

            Rect  rect  = EditorGUILayout.GetControlRect(Utilities.GL_EXPAND_WIDTH, Utilities.GL_HEIGHT_40);
            float width = rect.width;

            rect.width = 40f;
            if (GUI.Button(rect, IsExpanded ? "v" : ">"))
            {
                IsExpanded = !IsExpanded;
                GUIUtility.ExitGUI();
            }

            rect.x    += 40f;
            rect.width = width - (parameters.searchResult != null ? 140f : 40f);
            if (GUI.Button(rect, Title, Utilities.BoxGUIStyle) && Type == GroupType.Scene)
            {
                // If the container (scene, usually) is clicked, highlight it on Project view
                AssetDatabase.LoadAssetAtPath <SceneAsset>(Title).SelectInEditor();
            }

            if (parameters.searchResult != null)
            {
                rect.x    += width - 140f;
                rect.width = 100f;
                if (GUI.Button(rect, "Refresh"))
                {
                    parameters.searchResult.RefreshSearchResultGroup(this, parameters.noAssetDatabaseChanges);
                    GUIUtility.ExitGUI();
                }
            }

            if (IsExpanded)
            {
                GUI.color = Color.yellow;

                if (PendingSearch)
                {
                    GUILayout.Box("Lazy Search: this scene potentially has some references, hit Refresh to find them", Utilities.BoxGUIStyle);
                }
                else if (references.Count == 0)
                {
                    GUILayout.Box("No references found...", Utilities.BoxGUIStyle);
                }
                else
                {
                    if (parameters.pathDrawingMode == PathDrawingMode.Full)
                    {
                        for (int i = 0; i < references.Count; i++)
                        {
                            GUILayout.Space(5);
                            references[i].DrawOnGUIRecursively(parameters, null);
                        }
                    }
                    else
                    {
                        if (referencePathsShortUnique == null)
                        {
                            CalculateShortestPathsToReferences();
                        }

                        List <ReferencePath> pathsToDraw;
                        if (parameters.pathDrawingMode == PathDrawingMode.ShortRelevantParts)
                        {
                            pathsToDraw = referencePathsShortUnique;
                        }
                        else
                        {
                            pathsToDraw = referencePathsShortest;
                        }

                        for (int i = 0; i < pathsToDraw.Count; i++)
                        {
                            GUILayout.Space(5);

                            GUILayout.BeginHorizontal();

                            ReferencePath path = pathsToDraw[i];
                            path.startNode.DrawOnGUI(parameters, null);

                            ReferenceNode currentNode = path.startNode;
                            for (int j = 0; j < path.pathLinksToFollow.Length; j++)
                            {
                                ReferenceNode.Link link = currentNode[path.pathLinksToFollow[j]];
                                link.targetNode.DrawOnGUI(parameters, link.description);
                                currentNode = link.targetNode;
                            }

                            GUILayout.EndHorizontal();
                        }
                    }
                }
            }

            GUI.color = c;

            GUILayout.Space(10);
        }