static SystemInfo[] getSortedSystemInfos(SystemInfo[] systemInfos, SortMethod sortMethod) { if (sortMethod == SortMethod.Name) { return systemInfos .OrderBy(systemInfo => systemInfo.systemName) .ToArray(); } if (sortMethod == SortMethod.NameDescending) { return systemInfos .OrderByDescending(systemInfo => systemInfo.systemName) .ToArray(); } if (sortMethod == SortMethod.ExecutionTime) { return systemInfos .OrderBy(systemInfo => systemInfo.averageExecutionDuration) .ToArray(); } if (sortMethod == SortMethod.ExecutionTimeDescending) { return systemInfos .OrderByDescending(systemInfo => systemInfo.averageExecutionDuration) .ToArray(); } return systemInfos; }
void drawSystemInfos(SystemInfo[] systemInfos, bool isChildSysem) { var orderedSystemInfos = systemInfos .OrderByDescending(systemInfo => systemInfo.averageExecutionDuration) .ToArray(); foreach (var systemInfo in orderedSystemInfos) { EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(isChildSysem); systemInfo.isActive = EditorGUILayout.Toggle(systemInfo.isActive, GUILayout.Width(20)); EditorGUI.EndDisabledGroup(); var reactiveSystem = systemInfo.system as ReactiveSystem; if (reactiveSystem != null) { if (systemInfo.isActive) { reactiveSystem.Activate(); } else { reactiveSystem.Deactivate(); } } var avg = string.Format("Ø {0:0.000}", systemInfo.averageExecutionDuration).PadRight(9); var min = string.Format("min {0:0.000}", systemInfo.minExecutionDuration).PadRight(11); var max = string.Format("max {0:0.000}", systemInfo.maxExecutionDuration); EditorGUILayout.LabelField(systemInfo.systemName, avg + "\t" + min + "\t" + max); EditorGUILayout.EndHorizontal(); var debugSystem = systemInfo.system as DebugSystems; if (debugSystem != null) { var indent = EditorGUI.indentLevel; EditorGUI.indentLevel += 1; drawSystemInfos(debugSystem.systemInfos, true); EditorGUI.indentLevel = indent; } } }