Наследование: System.Attribute
Пример #1
0
        internal static void Rebuild(Assembly assembly)
        {
            Type[] typesFromAssembly = AssemblyHelper.GetTypesFromAssembly(assembly);
            Type[] array             = typesFromAssembly;
            for (int i = 0; i < array.Length; i++)
            {
                Type     type             = array[i];
                object[] customAttributes = type.GetCustomAttributes(typeof(CustomEditor), false);
                object[] array2           = customAttributes;
                int      j = 0;
                while (j < array2.Length)
                {
                    CustomEditor customEditor = (CustomEditor)array2[j];
                    CustomEditorAttributes.MonoEditorType monoEditorType = new CustomEditorAttributes.MonoEditorType();
                    if (customEditor.m_InspectedType == null)
                    {
                        Debug.Log("Can't load custom inspector " + type.Name + " because the inspected type is null.");
                    }
                    else if (!type.IsSubclassOf(typeof(Editor)))
                    {
                        if (!(type.FullName == "TweakMode") || !type.IsEnum || !(customEditor.m_InspectedType.FullName == "BloomAndFlares"))
                        {
                            Debug.LogWarning(type.Name + " uses the CustomEditor attribute but does not inherit from Editor.\nYou must inherit from Editor. See the Editor class script documentation.");
                        }
                    }
                    else
                    {
                        monoEditorType.m_InspectedType         = customEditor.m_InspectedType;
                        monoEditorType.m_InspectorType         = type;
                        monoEditorType.m_EditorForChildClasses = customEditor.m_EditorForChildClasses;
                        monoEditorType.m_IsFallback            = customEditor.isFallback;
                        CustomEditorAttributes.kSCustomEditors.Add(monoEditorType);
                        if (type.GetCustomAttributes(typeof(CanEditMultipleObjects), false).Length > 0)
                        {
                            CustomEditorAttributes.kSCustomMultiEditors.Add(monoEditorType);
                        }
                    }
IL_14D:
                    j++;
                    continue;
                    goto IL_14D;
                }
            }
        }