Пример #1
0
 private static void RebuildDrawers()
 {
     GUIDrawer.drawers = new Dictionary <Type, PropertyDrawer>();
     Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
     for (int i = 0; i < (int)assemblies.Length; i++)
     {
         Assembly assembly = assemblies[i];
         Type[]   types    = assembly.GetExportedTypes();
         for (int j = 0; j < (int)types.Length; j++)
         {
             Type type = types[j];
             if (typeof(PropertyDrawer).IsAssignableFrom(type) && type.IsClass && !type.IsAbstract)
             {
                 Type inspectedType = AttributeUtility.GetCustomDrawerAttribute(type);
                 if (inspectedType != null && !GUIDrawer.drawers.ContainsKey(inspectedType))
                 {
                     PropertyDrawer drawer = (PropertyDrawer)Activator.CreateInstance(type);
                     GUIDrawer.drawers.Add(inspectedType, drawer);
                     Type[] subTypes = TypeUtility.GetSubTypes(inspectedType);
                     for (int s = 0; s < subTypes.Length; s++)
                     {
                         Type subType = subTypes[s];
                         if (!GUIDrawer.drawers.ContainsKey(subType))
                         {
                             GUIDrawer.drawers.Add(subType, drawer);
                         }
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 public static Type GetCustomDrawerAttribute(Type type)
 {
     return(AttributeUtility.GetCustomDrawerAttribute(AttributeUtility.GetCustomAttributes(type)));
 }