internal static void Rebuild(Assembly assembly) { foreach (System.Type type in AssemblyHelper.GetTypesFromAssembly(assembly)) { foreach (CustomEditor customAttribute in type.GetCustomAttributes(typeof (CustomEditor), false)) { CustomEditorAttributes.MonoEditorType monoEditorType = new CustomEditorAttributes.MonoEditorType(); if (customAttribute.m_InspectedType == null) Debug.Log((object) ("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 || !(customAttribute.m_InspectedType.FullName == "BloomAndFlares")) Debug.LogWarning((object) (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 = customAttribute.m_InspectedType; monoEditorType.m_InspectorType = type; monoEditorType.m_EditorForChildClasses = customAttribute.m_EditorForChildClasses; monoEditorType.m_IsFallback = customAttribute.isFallback; CustomEditorAttributes.kSCustomEditors.Add(monoEditorType); if (type.GetCustomAttributes(typeof (CanEditMultipleObjects), false).Length > 0) CustomEditorAttributes.kSCustomMultiEditors.Add(monoEditorType); } } } }
internal static Type FindCustomEditorTypeByType(Type type, bool multiEdit) { if (!CustomEditorAttributes.s_Initialized) { Assembly[] loadedAssemblies = EditorAssemblies.loadedAssemblies; for (int i = loadedAssemblies.Length - 1; i >= 0; i--) { CustomEditorAttributes.Rebuild(loadedAssemblies[i]); } CustomEditorAttributes.s_Initialized = true; } List <CustomEditorAttributes.MonoEditorType> source = (!multiEdit) ? CustomEditorAttributes.kSCustomEditors : CustomEditorAttributes.kSCustomMultiEditors; int pass; for (pass = 0; pass < 2; pass++) { Type inspected; for (inspected = type; inspected != null; inspected = inspected.BaseType) { CustomEditorAttributes.MonoEditorType monoEditorType = source.FirstOrDefault((CustomEditorAttributes.MonoEditorType x) => (type == inspected || x.m_EditorForChildClasses) && pass == 1 == x.m_IsFallback && inspected == x.m_InspectedType); if (monoEditorType != null) { return(monoEditorType.m_InspectorType); } } } return(null); }
internal static void Rebuild(Assembly assembly) { foreach (System.Type type in AssemblyHelper.GetTypesFromAssembly(assembly)) { foreach (CustomEditor customAttribute in type.GetCustomAttributes(typeof(CustomEditor), false)) { CustomEditorAttributes.MonoEditorType monoEditorType = new CustomEditorAttributes.MonoEditorType(); if (customAttribute.m_InspectedType == null) { Debug.Log((object)("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 || !(customAttribute.m_InspectedType.FullName == "BloomAndFlares")) { Debug.LogWarning((object)(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 = customAttribute.m_InspectedType; monoEditorType.m_InspectorType = type; monoEditorType.m_EditorForChildClasses = customAttribute.m_EditorForChildClasses; monoEditorType.m_IsFallback = customAttribute.isFallback; CustomEditorAttributes.kSCustomEditors.Add(monoEditorType); if (type.GetCustomAttributes(typeof(CanEditMultipleObjects), false).Length > 0) { CustomEditorAttributes.kSCustomMultiEditors.Add(monoEditorType); } } } } }
internal static System.Type FindCustomEditorTypeByType(System.Type type, bool multiEdit) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey35 typeCAnonStorey35 = new CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey35(); // ISSUE: reference to a compiler-generated field typeCAnonStorey35.type = type; if (!CustomEditorAttributes.s_Initialized) { Assembly[] loadedAssemblies = EditorAssemblies.loadedAssemblies; for (int index = loadedAssemblies.Length - 1; index >= 0; --index) { CustomEditorAttributes.Rebuild(loadedAssemblies[index]); } CustomEditorAttributes.s_Initialized = true; } List <CustomEditorAttributes.MonoEditorType> source = !multiEdit ? CustomEditorAttributes.kSCustomEditors : CustomEditorAttributes.kSCustomMultiEditors; // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey37 typeCAnonStorey37 = new CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey37(); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field for (typeCAnonStorey37.pass = 0; typeCAnonStorey37.pass < 2; typeCAnonStorey37.pass = typeCAnonStorey37.pass + 1) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey36 typeCAnonStorey36 = new CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey36(); // ISSUE: reference to a compiler-generated field typeCAnonStorey36.\u003C\u003Ef__ref\u002453 = typeCAnonStorey35; // ISSUE: reference to a compiler-generated field typeCAnonStorey36.\u003C\u003Ef__ref\u002455 = typeCAnonStorey37; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field for (typeCAnonStorey36.inspected = typeCAnonStorey35.type; typeCAnonStorey36.inspected != null; typeCAnonStorey36.inspected = typeCAnonStorey36.inspected.BaseType) { // ISSUE: reference to a compiler-generated method CustomEditorAttributes.MonoEditorType monoEditorType = source.FirstOrDefault <CustomEditorAttributes.MonoEditorType>(new Func <CustomEditorAttributes.MonoEditorType, bool>(typeCAnonStorey36.\u003C\u003Em__4C)); if (monoEditorType != null) { return(monoEditorType.m_InspectorType); } } } return((System.Type)null); }
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; } } }
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; for (int j = 0; j < array2.Length; j++) { 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; CustomEditorAttributes.kSCustomEditors.Add(monoEditorType); if (type.GetCustomAttributes(typeof(CanEditMultipleObjects), false).Length > 0) { CustomEditorAttributes.kSCustomMultiEditors.Add(monoEditorType); } } } } } }
private static bool IsAppropriateEditor(CustomEditorAttributes.MonoEditorType editor, Type parentClass, bool isChildClass, bool isFallback) { return((!isChildClass || editor.m_EditorForChildClasses) && isFallback == editor.m_IsFallback && (parentClass == editor.m_InspectedType || (parentClass.IsGenericType && parentClass.GetGenericTypeDefinition() == editor.m_InspectedType))); }
private static bool IsAppropriateEditor(CustomEditorAttributes.MonoEditorType editor, Type parentClass, bool isChildClass, bool isFallback) { return((!isChildClass || editor.m_EditorForChildClasses) && isFallback == editor.m_IsFallback && parentClass == editor.m_InspectedType); }