public static void Draw(MaintainerWindow parentWindow) { if (issues == null) { LoadLastIssues(); } window = parentWindow; GUILayout.BeginHorizontal(); DrawSettingsSection(); DrawSearchSection(); GUILayout.EndHorizontal(); if (gotoIssue != null) { ShowIssue(gotoIssue); gotoIssue = null; } if (startSearch) { startSearch = false; window.RemoveNotification(); IssuesFinder.StartSearch(); window.Focus(); } }
public static void ClearNotification() { if (windowInstance) { windowInstance.RemoveNotification(); } }
private void StartProjectReferencesScan() { window.RemoveNotification(); ReferencesFinder.GetReferences(); window.Focus(); }
private static void DrawSearchSection() { GUILayout.BeginVertical(UIHelpers.panelWithBackground, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); GUILayout.Space(10); if (GUILayout.Button("Find issues!")) { startSearch = true; } GUILayout.Space(10); if (issues == null || issues.Length == 0) { GUILayout.Label("No issues"); } else { int fromIssue = issuesCurrentPage * ISSUES_PER_PAGE; int toIssue = fromIssue + Math.Min(ISSUES_PER_PAGE, issues.Length - fromIssue); GUILayout.Label("Issues " + fromIssue + " - " + toIssue + " from " + issues.Length); searchSectionScrollPosition = GUILayout.BeginScrollView(searchSectionScrollPosition); for (int i = fromIssue; i < toIssue; i++) { IssueRecord issue = issues[i]; UIHelpers.Separator(); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); DrawIssueIcon(issue); if (issue.source == IssueSource.Prefab) { DrawPrefabIcon(); } GUILayout.Label(issue.GetHeader(), UIHelpers.richLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); GUILayout.Label(issue.GetBody(), UIHelpers.richLabel); GUILayout.BeginHorizontal(UIHelpers.panelWithBackground); if (GUILayout.Button(new GUIContent("Show", "Selects Game Object with issue in the scene or Project Browser. Opens scene with needed Game Object if necessary and highlights this scene in the Project Browser."), GUILayout.Width(50))) { gotoIssue = issues[i]; } if (GUILayout.Button(new GUIContent("Copy", "Copies record text to the clipboard."), GUILayout.Width(50))) { textEditorForClipboard.content = new GUIContent(issue.ToString(true)); textEditorForClipboard.SelectAll(); textEditorForClipboard.Copy(); window.ShowNotification(new GUIContent("Issue record copied to clipboard!")); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.EndScrollView(); if (issuesTotalPages > 1) { GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUI.enabled = (issuesCurrentPage > 0); if (GUILayout.Button("<<", GUILayout.Width(50))) { window.RemoveNotification(); issuesCurrentPage = 0; searchSectionScrollPosition = Vector2.zero; } if (GUILayout.Button("<", GUILayout.Width(50))) { window.RemoveNotification(); issuesCurrentPage--; searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.Label((issuesCurrentPage + 1) + " of " + issuesTotalPages, UIHelpers.centeredLabel, GUILayout.Width(100)); GUI.enabled = (issuesCurrentPage < issuesTotalPages - 1); if (GUILayout.Button(">", GUILayout.Width(50))) { window.RemoveNotification(); issuesCurrentPage++; searchSectionScrollPosition = Vector2.zero; } if (GUILayout.Button(">>", GUILayout.Width(50))) { window.RemoveNotification(); issuesCurrentPage = issuesTotalPages - 1; searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.Space(5); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Copy report to clipboard")) { textEditorForClipboard.content = new GUIContent(IssuesFinder.GenerateReport(issues)); textEditorForClipboard.SelectAll(); textEditorForClipboard.Copy(); window.ShowNotification(new GUIContent("Report copied to clipboard!")); } if (GUILayout.Button("Export report...")) { string filePath = EditorUtility.SaveFilePanel("Save Issues Finder report", "", "MaintainerIssuesReport.txt", "txt"); if (!String.IsNullOrEmpty(filePath)) { StreamWriter sr = File.CreateText(filePath); sr.Write(IssuesFinder.GenerateReport(issues)); sr.Close(); window.ShowNotification(new GUIContent("Report saved!")); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.EndVertical(); }
protected virtual void DrawCollectionPages() { var fromItem = recordsCurrentPage * RecordsPerPage; var toItem = fromItem + Math.Min(RecordsPerPage, filteredRecords.Length - fromItem); using (new GUILayout.HorizontalScope(UIHelpers.panelWithBackground)) { GUILayout.Label(fromItem + 1 + " - " + toItem + " from " + filteredRecords.Length /* + " (" + records.Count + " total)"*/); GUILayout.FlexibleSpace(); using (new GUILayout.HorizontalScope()) { DrawPagesRightHeader(); } } UIHelpers.Separator(); DrawRecords(fromItem, toItem); UIHelpers.Separator(); if (recordsTotalPages <= 1) { return; } GUILayout.Space(5); using (new GUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); GUI.enabled = recordsCurrentPage > 0; if (UIHelpers.IconButton(CSIcons.DoubleArrowLeft)) { window.RemoveNotification(); recordsCurrentPage = 0; searchSectionScrollPosition = Vector2.zero; GetState().searchSectionScrollPosition = Vector2.zero; } if (UIHelpers.IconButton(CSIcons.ArrowLeft)) { window.RemoveNotification(); recordsCurrentPage--; searchSectionScrollPosition = Vector2.zero; GetState().searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.Label(recordsCurrentPage + 1 + " of " + recordsTotalPages, UIHelpers.centeredLabel); GUI.enabled = recordsCurrentPage < recordsTotalPages - 1; if (UIHelpers.IconButton(CSIcons.ArrowRight)) { window.RemoveNotification(); recordsCurrentPage++; searchSectionScrollPosition = Vector2.zero; GetState().searchSectionScrollPosition = Vector2.zero; } if (UIHelpers.IconButton(CSIcons.DoubleArrowRight)) { window.RemoveNotification(); recordsCurrentPage = recordsTotalPages - 1; searchSectionScrollPosition = Vector2.zero; GetState().searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.FlexibleSpace(); } }
protected virtual void ShowCollectionPages() { int fromIssue = recordsCurrentPage * RECORDS_PER_PAGE; int toIssue = fromIssue + Math.Min(RECORDS_PER_PAGE, filteredRecords.Length - fromIssue); using (layout.Horizontal(UIHelpers.panelWithBackground)) { GUILayout.Label(fromIssue + 1 + " - " + toIssue + " from " + filteredRecords.Length /* + " (" + records.Count + " total)"*/); GUILayout.FlexibleSpace(); using (layout.Horizontal()) { DrawPagesRightHeader(); } } UIHelpers.Separator(); searchSectionScrollPosition = GUILayout.BeginScrollView(searchSectionScrollPosition); for (int i = fromIssue; i < toIssue; i++) { DrawRecord(i); } GUILayout.EndScrollView(); UIHelpers.Separator(); if (recordsTotalPages <= 1) { return; } GUILayout.Space(5); using (layout.Horizontal()) { GUILayout.FlexibleSpace(); GUI.enabled = recordsCurrentPage > 0; if (UIHelpers.IconButton(CSIcons.DoubleArrowLeft)) { window.RemoveNotification(); recordsCurrentPage = 0; searchSectionScrollPosition = Vector2.zero; } if (UIHelpers.IconButton(CSIcons.ArrowLeft)) { window.RemoveNotification(); recordsCurrentPage--; searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.Label(recordsCurrentPage + 1 + " of " + recordsTotalPages, UIHelpers.centeredLabel); GUI.enabled = recordsCurrentPage < recordsTotalPages - 1; if (UIHelpers.IconButton(CSIcons.ArrowRight)) { window.RemoveNotification(); recordsCurrentPage++; searchSectionScrollPosition = Vector2.zero; } if (UIHelpers.IconButton(CSIcons.DoubleArrowRight)) { window.RemoveNotification(); recordsCurrentPage = recordsTotalPages - 1; searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.FlexibleSpace(); } }
protected virtual void ShowCollectionPages() { int fromIssue = recordsCurrentPage * RECORDS_PER_PAGE; int toIssue = fromIssue + Math.Min(RECORDS_PER_PAGE, records.Length - fromIssue); GUILayout.Label("Results " + fromIssue + " - " + toIssue + " from " + records.Length); searchSectionScrollPosition = GUILayout.BeginScrollView(searchSectionScrollPosition); for (int i = fromIssue; i < toIssue; i++) { bool recordRemoved; DrawRecord(i, out recordRemoved); if (recordRemoved) { recordsTotalPages = (int)Math.Ceiling((double)records.Length / RECORDS_PER_PAGE); if (recordsCurrentPage + 1 > recordsTotalPages) { recordsCurrentPage = recordsTotalPages - 1; } break; } } GUILayout.EndScrollView(); if (recordsTotalPages <= 1) { return; } GUILayout.Space(5); using (UIHelpers.Horizontal()) { GUILayout.FlexibleSpace(); GUI.enabled = recordsCurrentPage > 0; if (GUILayout.Button("<<", GUILayout.Width(50))) { window.RemoveNotification(); recordsCurrentPage = 0; searchSectionScrollPosition = Vector2.zero; } if (GUILayout.Button("<", GUILayout.Width(50))) { window.RemoveNotification(); recordsCurrentPage--; searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.Label(recordsCurrentPage + 1 + " of " + recordsTotalPages, UIHelpers.centeredLabel, GUILayout.Width(100)); GUI.enabled = recordsCurrentPage < recordsTotalPages - 1; if (GUILayout.Button(">", GUILayout.Width(50))) { window.RemoveNotification(); recordsCurrentPage++; searchSectionScrollPosition = Vector2.zero; } if (GUILayout.Button(">>", GUILayout.Width(50))) { window.RemoveNotification(); recordsCurrentPage = recordsTotalPages - 1; searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.FlexibleSpace(); } }