Ejemplo n.º 1
0
 void OnEnable()
 {
     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");
     targetObject      = target as EZScriptStatisticsObject;
 }
Ejemplo n.º 2
0
        private void DrawResult(EZScriptStatisticsObject targetObject)
        {
            showAsAsset = EditorGUILayout.Toggle("Show Script As TextAsset", showAsAsset);

            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 (showAsAsset)
                        {
                            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();
                    }
                }
            }
        }