private void DrawResult(EZScriptStatistics targetObject) { foreach (Contributor contributor in targetObject.result) { EditorGUILayout.BeginHorizontal(); float unitWidth = Math.Min(60, EditorGUIUtility.currentViewWidth / 10); contributor.foldout = EditorGUILayout.Foldout(contributor.foldout, contributor.author); EditorGUILayout.LabelField("proportion: " + contributor.proportion.ToString("00.00%"), new GUILayoutOption[] { GUILayout.Width(unitWidth * 2) }); EditorGUILayout.LabelField("file count: " + contributor.scriptList.Count.ToString(), new GUILayoutOption[] { GUILayout.Width(unitWidth * 2) }); EditorGUILayout.TextField(contributor.lineCount.ToString(), new GUILayoutOption[] { GUILayout.Width(unitWidth) }); EditorGUILayout.TextField(contributor.validLineCount.ToString(), new GUILayoutOption[] { GUILayout.Width(unitWidth) }); EditorGUILayout.EndHorizontal(); if (contributor.foldout) { foreach (ScriptInfo script in contributor.scriptList) { EditorGUILayout.BeginHorizontal(); EditorGUI.indentLevel++; if (m_ShowAsset.boolValue) { EditorGUILayout.ObjectField(script.fileObject, typeof(UnityEngine.Object), true); } else { EditorGUILayout.TextField(script.filePath); } EditorGUI.indentLevel--; EditorGUILayout.TextField(script.createTime, new GUILayoutOption[] { GUILayout.Width(unitWidth * 3) }); EditorGUILayout.TextField(script.lineCount.ToString(), new GUILayoutOption[] { GUILayout.Width(unitWidth) }); EditorGUILayout.TextField(script.validLineCount.ToString(), new GUILayoutOption[] { GUILayout.Width(unitWidth) }); EditorGUILayout.EndHorizontal(); } } } }
void OnEnable() { statistics = target as EZScriptStatistics; m_FilePatterns = serializedObject.FindProperty("filePatterns"); m_IncludePaths = serializedObject.FindProperty("includePaths"); m_ExcludePaths = serializedObject.FindProperty("excludePaths"); m_InfoLineCount = serializedObject.FindProperty("infoLineCount"); m_AuthorRegex = serializedObject.FindProperty("authorRegex"); m_CreateTimeRegex = serializedObject.FindProperty("createTimeRegex"); m_ValidLineRegex = serializedObject.FindProperty("validLineRegex"); }