protected void onDebugInfo()
        {
            RNDebugInEditor.logs.info.Clear();
            RNDebugInEditor.warnings.info.Clear();
            RNDebugInEditor.errors.info.Clear();

            RNDebugEx.invoke(target, "onLogs", RNDebugInEditor.logs);
            RNDebugEx.invoke(target, "onWarnings", RNDebugInEditor.warnings);
            RNDebugEx.invoke(target, "onErrors", RNDebugInEditor.errors);

            if (RNDebugInEditor.logs.info.Count > 0 ||
                RNDebugInEditor.warnings.info.Count > 0 ||
                RNDebugInEditor.errors.info.Count > 0)
            {
                Area.separatorLine();

                //using (area())
                {
                    if (RNDebugInEditor.logs.info.Count > 0)
                    {
                        foreach (var info in RNDebugInEditor.logs.info)
                        {
                            EditorGUILayout.HelpBox(info.ToString(), MessageType.Info);
                        }
                    }
                    if (RNDebugInEditor.warnings.info.Count > 0)
                    {
                        foreach (var info in RNDebugInEditor.warnings.info)
                        {
                            EditorGUILayout.HelpBox(info.ToString(), MessageType.Warning);
                        }
                    }
                    if (RNDebugInEditor.errors.info.Count > 0)
                    {
                        foreach (var info in RNDebugInEditor.errors.info)
                        {
                            EditorGUILayout.HelpBox(info.ToString(), MessageType.Error);
                        }
                    }


                    EditorGUILayout.Separator();
                }
            }
        }
Beispiel #2
0
        protected void begin(string areaName)
        {
            using (Inspector.horizontal())
            {
                var pos = GUILayoutUtility.GetRect(0.0f, 16.0f);

                open = GUI.Toggle(pos, open, new GUIContent(areaName), headerStyle);
                //open = EditorGUILayout.Toggle(areaName, open, headerStyle);
                //open = EditorGUILayout.Foldout(open, new GUIContent(areaName), headerStyle);


                EditorGUILayout.Separator();
                _editor.onButtons(areaName, 0, GUILayout.ExpandWidth(false));
            }

            Area.separatorLine();
            if (open)
            {
                //画窗口需要下面一行代码
                EditorGUILayout.BeginVertical(Area.boxStyle);
                //++EditorGUI.indentLevel;
            }
        }
        protected void onDebug()
        {
            if (_debug)
            {
                using (horizontal())
                    debugToggles();

                using (vertical())
                {
                    GUI.enabled = false;

                    if (_static)
                    {
                        Area.separatorLine();
                        if (_field)
                        {
                            foreach (var field in getAllFields(target.GetType(), _baseType, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly))
                            {
                                if (excludeField(field.Name))
                                {
                                    continue;
                                }

                                if (propertyField(field.FieldType, field.Name, field.GetValue(target)) == false)
                                {
                                    helpBox(field.Name, field.FieldType);
                                }
                            }
                        }
                        if (_property)
                        {
                            foreach (var property in getAllPropertys(target.GetType(), _baseType, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly))
                            {
                                object v; try { v = property.GetValue(target, null); } catch (System.Exception e) { helpBox(property.Name, e.InnerException); continue; }

                                if (propertyField(property.PropertyType, property.Name, v) == false)
                                {
                                    helpBox(property.Name, property.PropertyType);
                                }
                            }
                        }
                    }


                    if (_baseType)
                    {
                        Area.separatorLine();
                        if (_field)
                        {
                            foreach (var field in getAllFields(target.GetType().BaseType, true, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
                            {
                                if (excludeField(field.Name))
                                {
                                    continue;
                                }
                                if (field.GetCustomAttributes(typeof(SerializeField), true).Length > 0)
                                {
                                    continue;
                                }

                                if (field.IsPublic == false || (_nonSerialized && field.GetCustomAttributes(typeof(System.NonSerializedAttribute), true).Length > 0))
                                {
                                    if (propertyField(field.FieldType, field.Name, field.GetValue(target)) == false)
                                    {
                                        helpBox(field.Name, field.FieldType);
                                    }
                                }
                            }
                        }
                        if (_property)
                        {
                            foreach (var property in getAllPropertys(target.GetType().BaseType, true, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
                            {
                                if (excludeProperty(property.Name))
                                {
                                    continue;
                                }

                                object v; try { v = property.GetValue(target, null); } catch (System.Exception e) { helpBox(property.Name, e.InnerException); continue; }

                                if (propertyField(property.PropertyType, property.Name, v) == false)
                                {
                                    helpBox(property.Name, property.PropertyType);
                                }
                            }
                        }
                    }

                    Area.separatorLine();
                    if (_field)
                    {
                        foreach (var field in getAllFields(target.GetType(), false, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
                        {
                            if (excludeField(field.Name))
                            {
                                continue;
                            }
                            if (field.GetCustomAttributes(typeof(SerializeField), true).Length > 0)
                            {
                                continue;
                            }

                            if (field.IsPublic == false || (_nonSerialized && field.GetCustomAttributes(typeof(System.NonSerializedAttribute), true).Length > 0))
                            {
                                if (propertyField(field.FieldType, field.Name, field.GetValue(target)) == false)
                                {
                                    helpBox(field.Name, field.FieldType);
                                }
                            }
                        }
                    }
                    if (_property)
                    {
                        foreach (var property in getAllPropertys(target.GetType(), false, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
                        {
                            if (excludeProperty(property.Name))
                            {
                                continue;
                            }

                            object v; try { v = property.GetValue(target, null); } catch (System.Exception e) { helpBox(property.Name, e.InnerException); continue; }

                            if (propertyField(property.PropertyType, property.Name, v) == false)
                            {
                                helpBox(property.Name, property.PropertyType);
                            }
                        }
                    }

                    GUI.enabled = true;
                }

                if (_refresh)
                {
                    EditorUtility.SetDirty(target);
                }
            }
        }