Ejemplo n.º 1
0
        private void DrawMoreButton(GameObjectIssueRecord record)
        {
            if (!UIHelpers.RecordButton(record, "Shows menu with additional actions for this record.", CSIcons.More))
            {
                return;
            }

            GenericMenu menu = new GenericMenu();

            if (!string.IsNullOrEmpty(record.path))
            {
                menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () =>
                {
                    if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, record.path))
                    {
                        MaintainerWindow.ShowNotification("Ignore added: " + record.path);
                        IssuesFiltersWindow.Refresh();
                    }
                    else
                    {
                        MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                    }
                });

                DirectoryInfo dir = Directory.GetParent(record.path);
                if (dir.Name != "Assets")
                {
                    menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () =>
                    {
                        if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, dir.ToString()))
                        {
                            MaintainerWindow.ShowNotification("Ignore added: " + dir);
                            IssuesFiltersWindow.Refresh();
                        }
                        else
                        {
                            MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                        }
                    });
                }
            }

            if (!string.IsNullOrEmpty(record.componentName))
            {
                menu.AddItem(new GUIContent("Ignore/Add component to ignores"), false, () =>
                {
                    if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.componentIgnores, record.componentName))
                    {
                        MaintainerWindow.ShowNotification("Ignore added: " + record.componentName);
                        IssuesFiltersWindow.Refresh();
                    }
                    else
                    {
                        MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                    }
                });
            }
            menu.ShowAsContext();
        }
Ejemplo n.º 2
0
        private void DrawRecordButtons(RecordBase record)
        {
            using (UIHelpers.Horizontal(UIHelpers.panelWithBackground))
            {
                AddShowButtonIfPossible(record);

                AssetRecord assetRecord = record as AssetRecord;
                if (assetRecord != null)
                {
                    if (GUILayout.Button(new GUIContent("Reveal", "Reveals item in system default File Manager like Explorer on Windows or Finder on Mac."), UIHelpers.recordButton))
                    {
                        EditorUtility.RevealInFinder(assetRecord.path);
                    }

                    if (GUILayout.Button("More ...", UIHelpers.recordButton))
                    {
                        GenericMenu menu = new GenericMenu();
                        if (!string.IsNullOrEmpty(assetRecord.path))
                        {
                            menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () =>
                            {
                                if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, assetRecord.assetDatabasePath))
                                {
                                    MaintainerSettings.Save();
                                    MaintainerWindow.ShowNotification("Ignore added: " + assetRecord.assetDatabasePath);
                                    CleanerIgnoresWindow.Refresh();
                                }
                                else
                                {
                                    MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                }
                            });

                            DirectoryInfo dir = Directory.GetParent(assetRecord.assetDatabasePath);
                            if (dir.Name != "Assets")
                            {
                                menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () =>
                                {
                                    if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, dir.ToString()))
                                    {
                                        MaintainerSettings.Save();
                                        MaintainerWindow.ShowNotification("Ignore added: " + dir);
                                        CleanerIgnoresWindow.Refresh();
                                    }
                                    else
                                    {
                                        MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                    }
                                });
                            }
                        }
                        menu.ShowAsContext();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void DrawMoreButton(AssetRecord assetRecord)
        {
            if (UIHelpers.RecordButton(assetRecord, "Shows menu with additional actions for this record.", CSIcons.More))
            {
                GenericMenu menu = new GenericMenu();
                if (!string.IsNullOrEmpty(assetRecord.path))
                {
                    menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () =>
                    {
                        if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, assetRecord.assetDatabasePath))
                        {
                            MaintainerWindow.ShowNotification("Ignore added: " + assetRecord.assetDatabasePath);
                            CleanerFiltersWindow.Refresh();
                        }
                        else
                        {
                            MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                        }
                    });

                    DirectoryInfo dir = Directory.GetParent(assetRecord.assetDatabasePath);
                    if (dir.Name != "Assets")
                    {
                        menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () =>
                        {
                            if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, dir.ToString()))
                            {
                                MaintainerWindow.ShowNotification("Ignore added: " + dir);
                                CleanerFiltersWindow.Refresh();
                            }
                            else
                            {
                                MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                            }
                        });
                    }
                }
                menu.ShowAsContext();
            }
        }
Ejemplo n.º 4
0
        protected override void DrawRecord(int recordIndex, out bool recordRemoved)
        {
            recordRemoved = false;
            RecordBase record = records[recordIndex];

            UIHelpers.Separator();

            using (UIHelpers.Horizontal())
            {
                DrawSeverityIcon(record);
                if (record.location == RecordLocation.Prefab)
                {
                    UIHelpers.DrawPrefabIcon();
                }
                GUILayout.Label(record.GetHeader(), UIHelpers.richLabel, GUILayout.ExpandWidth(false));
            }

            GUILayout.Label(record.GetBody(), UIHelpers.richLabel);

            using (UIHelpers.Horizontal(UIHelpers.panelWithBackground))
            {
                AddShowButtonIfPossible(record);

                if (GUILayout.Button(new GUIContent("Copy", "Copies record text to the clipboard."), UIHelpers.recordButton))
                {
                    EditorGUIUtility.systemCopyBuffer = record.ToString(true);
                    MaintainerWindow.ShowNotification("Issue record copied to clipboard!");
                }

                if (GUILayout.Button(new GUIContent("Hide", "Hide this issue from the results list.\nUseful when you fixed issue and wish to hide it away."), UIHelpers.recordButton))
                {
                    // ReSharper disable once CoVariantArrayConversion
                    records = CSArrayTools.RemoveAt(records as IssueRecord[], recordIndex);
                    SearchResultsStorage.IssuesSearchResults = (IssueRecord[])records;
                    recordRemoved = true;
                    return;
                }

                //UIHelpers.VerticalSeparator();
                GameObjectIssueRecord objectIssue = record as GameObjectIssueRecord;
                if (objectIssue != null)
                {
                    if (GUILayout.Button("More ...", UIHelpers.recordButton))
                    {
                        GenericMenu menu = new GenericMenu();
                        if (!string.IsNullOrEmpty(objectIssue.path))
                        {
                            menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () =>
                            {
                                if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, objectIssue.path))
                                {
                                    MaintainerSettings.Save();
                                    MaintainerWindow.ShowNotification("Ignore added: " + objectIssue.path);
                                    IssuesIgnoresWindow.Refresh();
                                }
                                else
                                {
                                    MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                }
                            });

                            DirectoryInfo dir = Directory.GetParent(objectIssue.path);
                            if (dir.Name != "Assets")
                            {
                                menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () =>
                                {
                                    if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, dir.ToString()))
                                    {
                                        MaintainerSettings.Save();
                                        MaintainerWindow.ShowNotification("Ignore added: " + dir);
                                        IssuesIgnoresWindow.Refresh();
                                    }
                                    else
                                    {
                                        MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                    }
                                });
                            }
                        }

                        if (!string.IsNullOrEmpty(objectIssue.component))
                        {
                            menu.AddItem(new GUIContent("Ignore/Add component to ignores"), false, () =>
                            {
                                if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.componentIgnores, objectIssue.component))
                                {
                                    MaintainerSettings.Save();
                                    MaintainerWindow.ShowNotification("Ignore added: " + objectIssue.component);
                                    IssuesIgnoresWindow.Refresh();
                                }
                                else
                                {
                                    MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                }
                            });
                        }
                        menu.ShowAsContext();
                    }
                }
            }
        }