예제 #1
0
        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);
                }
            }
        }