Exemplo n.º 1
0
 private void LoadEditors()
 {
     Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
     for (int i = 0; i < assemblies.Length; i++)
     {
         Type[] exportedTypes = assemblies[i].GetExportedTypes();
         for (int j = 0; j < exportedTypes.Length; j++)
         {
             Type type = exportedTypes[j];
             if (type.IsClass && typeof(MainEdChild).IsAssignableFrom(type) && type.Name != "MainEdChild")
             {
                 MainEdChild item = (MainEdChild)Activator.CreateInstance(type);
                 MainEditorWindow.editors.Add(item);
             }
         }
     }
     MainEditorWindow.editors.Sort((MainEdChild a, MainEdChild b) => a.order.CompareTo(b.order));
     MainEditorWindow.labels = new GUIContent[MainEditorWindow.editors.Count];
     for (int k = 0; k < MainEditorWindow.editors.Count; k++)
     {
         MainEditorWindow.labels[k] = new GUIContent(MainEditorWindow.editors[k].label);
     }
     MainEditorWindow.edIdx = 0;
     MainEditorWindow.editors[MainEditorWindow.edIdx].editorWindow = this;
     MainEditorWindow.editors[MainEditorWindow.edIdx].OnFocus();
 }
Exemplo n.º 2
0
 public static void AddChildEditor(MainEdChild ed)
 {
     MainEditorWindow.editors.Add(ed);
     MainEditorWindow.editors.Sort((MainEdChild a, MainEdChild b) => a.order.CompareTo(b.order));
     MainEditorWindow.labels = new GUIContent[MainEditorWindow.editors.Count];
     for (int i = 0; i < MainEditorWindow.editors.Count; i++)
     {
         MainEditorWindow.labels[i] = new GUIContent(MainEditorWindow.editors[i].label);
     }
 }