예제 #1
0
        private void OnLogsByAreaGUI()
        {
            var errorCount   = 0;
            var warningCount = 0;
            var infoCount    = 0;

            GetCounts(_projLogs, out errorCount, out warningCount, out infoCount);

            var projectRect = EditorGUILayout.BeginHorizontal();

            if (Event.current.type == EventType.Repaint)
            {
                var originalColor = GUI.color;
                GUI.color = AssetValidatorGraphicsUtility.GetVLogHeaderColor(null);
                AssetValidatorGraphicsUtility.Styles.HeaderBackground.Draw(projectRect, false, false, false, false);
                GUI.color = originalColor;
            }

            _showProjectAssetsValidationFoldout = EditorGUILayout.Foldout(_showProjectAssetsValidationFoldout, "Project");

            var fieldRect = new Rect(projectRect)
            {
                xMin  = projectRect.xMin + projectRect.width - 150f,
                width = 50f
            };

            // Now that we have drawn our title, lets draw the aggregate logs if possible
            GUI.Label(fieldRect, new GUIContent(infoCount.ToString(), AssetValidatorGraphicsUtility.InfoIconSmall));
            fieldRect.x += 50f;
            GUI.Label(fieldRect, new GUIContent(warningCount.ToString(), AssetValidatorGraphicsUtility.WarningIconSmall));
            fieldRect.x += 50f;
            GUI.Label(fieldRect, new GUIContent(errorCount.ToString(), AssetValidatorGraphicsUtility.ErrorIconSmall));

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (_showProjectAssetsValidationFoldout)
            {
                EditorGUI.indentLevel++;
                foreach (var projLog in _projLogs)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(25f);
                    AssetValidatorGraphicsUtility.DrawVLogHeaderGUI(projLog.objectPath, projLog);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(25f);
                    AssetValidatorGraphicsUtility.DrawVLogBodyGUI(projLog);
                    EditorGUILayout.EndHorizontal();
                    GUILayout.Space(15f);
                }
                EditorGUI.indentLevel--;
            }

            GetCounts(_sceneLogs, out errorCount, out warningCount, out infoCount);

            var sceneRect = EditorGUILayout.BeginHorizontal();

            if (Event.current.type == EventType.Repaint)
            {
                var originalColor = GUI.color;
                GUI.color = AssetValidatorGraphicsUtility.GetVLogHeaderColor(null);
                AssetValidatorGraphicsUtility.Styles.HeaderBackground.Draw(sceneRect, false, false, false, false);
                GUI.color = originalColor;
            }

            _showSceneValidationFoldout = EditorGUILayout.Foldout(_showSceneValidationFoldout, "Scenes");

            fieldRect = new Rect(sceneRect)
            {
                xMin  = sceneRect.xMin + sceneRect.width - 150f,
                width = 50f
            };

            // Now that we have drawn our title, lets draw the aggregate logs if possible
            GUI.Label(fieldRect, new GUIContent(infoCount.ToString(), AssetValidatorGraphicsUtility.InfoIconSmall));
            fieldRect.x += 50f;
            GUI.Label(fieldRect, new GUIContent(warningCount.ToString(), AssetValidatorGraphicsUtility.WarningIconSmall));
            fieldRect.x += 50f;
            GUI.Label(fieldRect, new GUIContent(errorCount.ToString(), AssetValidatorGraphicsUtility.ErrorIconSmall));

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (_showSceneValidationFoldout)
            {
                EditorGUI.indentLevel++;
                foreach (var sceneLog in _sceneLogs)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(25f);
                    AssetValidatorGraphicsUtility.DrawVLogHeaderGUI(sceneLog.objectPath, sceneLog);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(25f);
                    AssetValidatorGraphicsUtility.DrawVLogBodyGUI(sceneLog);
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(15f);
                }
                EditorGUI.indentLevel--;
            }

            GetCounts(_miscLogs, out errorCount, out warningCount, out infoCount);

            var miscRect = EditorGUILayout.BeginHorizontal();

            if (Event.current.type == EventType.Repaint)
            {
                var originalColor = GUI.color;
                GUI.color = AssetValidatorGraphicsUtility.GetVLogHeaderColor(null);
                AssetValidatorGraphicsUtility.Styles.HeaderBackground.Draw(miscRect, false, false, false, false);
                GUI.color = originalColor;
            }

            _showMiscValidationFoldout = EditorGUILayout.Foldout(_showMiscValidationFoldout, "Misc");

            fieldRect = new Rect(miscRect)
            {
                xMin  = miscRect.xMin + miscRect.width - 140f,
                width = 40f
            };

            // Now that we have drawn our title, lets draw the aggregate logs if possible
            GUI.Label(fieldRect, new GUIContent(infoCount.ToString(), AssetValidatorGraphicsUtility.InfoIconSmall));
            fieldRect.x += 40f;
            GUI.Label(fieldRect, new GUIContent(warningCount.ToString(), AssetValidatorGraphicsUtility.WarningIconSmall));
            fieldRect.x += 40f;
            GUI.Label(fieldRect, new GUIContent(errorCount.ToString(), AssetValidatorGraphicsUtility.ErrorIconSmall));

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (_showMiscValidationFoldout)
            {
                EditorGUI.indentLevel++;
                foreach (var miscLog in _miscLogs)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(25f);
                    AssetValidatorGraphicsUtility.DrawVLogHeaderGUI(miscLog.validatorName, miscLog);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(25f);
                    AssetValidatorGraphicsUtility.DrawVLogBodyGUI(miscLog);
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(15f);
                }
                EditorGUI.indentLevel--;
            }
        }
예제 #2
0
        private void OnLogsByValidatorGUI()
        {
            var errorCount   = 0;
            var warningCount = 0;
            var infoCount    = 0;

            var count = 0;

            foreach (var kvp in _logsByValidator)
            {
                GetCounts(kvp.ToArray(), out errorCount, out warningCount, out infoCount);

                var rect = EditorGUILayout.BeginHorizontal();

                if (Event.current.type == EventType.Repaint)
                {
                    var originalColor = GUI.color;
                    GUI.color = AssetValidatorGraphicsUtility.GetVLogHeaderColor(null);
                    AssetValidatorGraphicsUtility.Styles.HeaderBackground.Draw(rect, false, false, false, false);
                    GUI.color = originalColor;
                }

                _foldoutsPerValidator[count] = EditorGUILayout.Foldout(_foldoutsPerValidator[count], kvp.Key);

                var fieldRect = new Rect(rect)
                {
                    xMin  = rect.xMin + rect.width - 150f,
                    width = 50f
                };

                // Now that we have drawn our title, lets draw the aggregate logs if possible
                GUI.Label(fieldRect, new GUIContent(infoCount.ToString(), AssetValidatorGraphicsUtility.InfoIconSmall));
                fieldRect.x += 50f;
                GUI.Label(fieldRect, new GUIContent(warningCount.ToString(), AssetValidatorGraphicsUtility.WarningIconSmall));
                fieldRect.x += 50f;
                GUI.Label(fieldRect, new GUIContent(errorCount.ToString(), AssetValidatorGraphicsUtility.ErrorIconSmall));

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();

                if (_foldoutsPerValidator[count])
                {
                    foreach (var log in kvp)
                    {
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Space(25f);
                        AssetValidatorGraphicsUtility.DrawVLogHeaderGUI(log.validatorName, log);
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Space(25f);
                        AssetValidatorGraphicsUtility.DrawVLogBodyGUI(log);
                        EditorGUILayout.EndHorizontal();

                        GUILayout.Space(15f);
                    }
                }

                count++;
            }
        }