Beispiel #1
0
        static EditorWindowTool()
        {
            Type type = typeof(EditorWindow);

            m_Parent = type.GetField("m_Parent", BindingFlags.Instance | BindingFlags.NonPublic);
            _windows = new List <EditorWindowItem>();
            var em = type.GetSubTypesInAssemblys().GetEnumerator();

            while (em.MoveNext())
            {
                var _type = em.Current;
                if (_type.IsAbstract || !_type.IsDefined(typeof(EditorWindowCacheAttribute), false))
                {
                    continue;
                }
                EditorWindowCacheAttribute attr = _type.GetCustomAttributes(typeof(EditorWindowCacheAttribute), false).First() as EditorWindowCacheAttribute;
                windows.Add(new EditorWindowItem(_type, attr.searchName));
            }
            windows.Sort((a, b) => { return(a.searchName.CompareTo(b.searchName)); });
            AddDefautEditorWindows();
        }
Beispiel #2
0
 private static void FreshInfoDic()
 {
     Windows.Clear();
     foreach (var item in typeof(EditorWindow).GetSubTypesInAssemblys())
     {
         if (!item.IsDefined(typeof(EditorWindowCacheAttribute), false))
         {
             continue;
         }
         object[] attrs = item.GetCustomAttributes(false);
         for (int i = 0; i < attrs.Length; i++)
         {
             if (attrs[i] is EditorWindowCacheAttribute)
             {
                 EditorWindowCacheAttribute attr = attrs[i] as EditorWindowCacheAttribute;
                 Windows.Add(new EditorWindowInfo(item, string.IsNullOrEmpty(attr.searchName) ? item.FullName : attr.searchName));
             }
         }
     }
     AddDefautEditorWindows();
 }