public int CompareTo(AnalysisDataSortType sortType, UnityDebugViewerAnalysisData data) { int result = 0; switch (sortType) { case AnalysisDataSortType.TotalCount: result = this.totalCount - data.totalCount; break; case AnalysisDataSortType.LogCount: result = this.logCount - data.logCount; break; case AnalysisDataSortType.WarningCount: result = this.warningCount - data.warningCount; break; case AnalysisDataSortType.ErrorCount: result = this.errorCount - data.errorCount; break; } /// 降序排列 if (result > 0) { result = -1; } else if (result < 0) { result = 1; } return(result); }
private void DrawAnalysisMessage() { if (analysisDataTreeView == null) { return; } Rect analysisMenuBarRect = new Rect(lowerPanelRect.x, lowerPanelRect.y, lowerPanelRect.width, menuBarHeight); Rect titleRect = new Rect(lowerPanelRect.x, analysisMenuBarRect.y + analysisMenuBarRect.height, lowerPanelRect.width, 1.5f * EditorGUIUtility.singleLineHeight); Rect analysisRect = new Rect(lowerPanelRect.x, titleRect.y + titleRect.height, lowerPanelRect.width, lowerPanelRect.height - titleRect.height - analysisMenuBarRect.height); GUILayout.BeginArea(analysisMenuBarRect, EditorStyles.toolbar); { GUILayout.BeginHorizontal(); { EditorGUI.BeginChangeCheck(); GUILayout.Label(new GUIContent("Sort Type: "), EditorStyles.toolbarButton); analysisDataSortType = (AnalysisDataSortType)EditorGUILayout.EnumPopup(analysisDataSortType, EditorStyles.toolbarPopup); if (EditorGUI.EndChangeCheck()) { this.editorManager.activeEditor.analysisDataManager.Sort(analysisDataSortType); } GUILayout.FlexibleSpace(); string tempSearchText = UnityDebugViewerWindowUtility.CopyPasteTextField(this.analysisSearchText, UnityDebugViewerWindowStyleUtility.toolbarSearchTextStyle, GUILayout.MinWidth(180f), GUILayout.MaxWidth(300f)); if (tempSearchText.Equals(this.analysisSearchText) == false) { /// update search result first this.editorManager.activeEditor.analysisDataManager.Search(tempSearchText); if (string.IsNullOrEmpty(tempSearchText) && string.IsNullOrEmpty(this.analysisSearchText) == false) { analysisDataTreeView.MoveToSelectedNode(analysisRect, ref this.analysisPanelScrollPos); } this.analysisSearchText = tempSearchText; } } GUILayout.EndHorizontal(); } GUILayout.EndArea(); GUILayout.BeginArea(analysisRect); { this.analysisPanelScrollPos = GUILayout.BeginScrollView(this.analysisPanelScrollPos); { analysisDataTreeView.DrawTreeLayout(analysisRect, ref this.analysisPanelScrollPos); } GUILayout.EndScrollView(); } GUILayout.EndArea(); /// draw title at last to make sure title is always on the top analysisDataTreeView.DrawColumnTitle(titleRect); }
public void Sort(AnalysisDataSortType type) { this.sortType = type; root.Traverse(OnSortChildren); }