Пример #1
0
 private void AddCustomSections()
 {
     Assembly[] loadedAssemblies = EditorAssemblies.loadedAssemblies;
     for (int i = 0; i < loadedAssemblies.Length; i++)
     {
         Assembly assembly          = loadedAssemblies[i];
         Type[]   typesFromAssembly = AssemblyHelper.GetTypesFromAssembly(assembly);
         Type[]   array             = typesFromAssembly;
         for (int j = 0; j < array.Length; j++)
         {
             Type         type    = array[j];
             MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
             for (int k = 0; k < methods.Length; k++)
             {
                 MethodInfo     methodInfo     = methods[k];
                 PreferenceItem preferenceItem = Attribute.GetCustomAttribute(methodInfo, typeof(PreferenceItem)) as PreferenceItem;
                 if (preferenceItem != null)
                 {
                     PreferencesWindow.OnGUIDelegate onGUIDelegate = Delegate.CreateDelegate(typeof(PreferencesWindow.OnGUIDelegate), methodInfo) as PreferencesWindow.OnGUIDelegate;
                     if (onGUIDelegate != null)
                     {
                         this.m_Sections.Add(new PreferencesWindow.Section(preferenceItem.name, onGUIDelegate));
                     }
                 }
             }
         }
     }
 }