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;
}
Type result;
if (type == null)
{
result = null;
}
else
{
Dictionary <Type, Type> dictionary = (!multiEdit) ? CustomEditorAttributes.kCachedEditorForType : CustomEditorAttributes.kCachedMultiEditorForType;
Type inspectorType;
if (dictionary.TryGetValue(type, out inspectorType))
{
result = inspectorType;
}
else
{
List <CustomEditorAttributes.MonoEditorType> list = (!multiEdit) ? CustomEditorAttributes.kSCustomEditors : CustomEditorAttributes.kSCustomMultiEditors;
for (int j = 0; j < 2; j++)
{
for (Type type2 = type; type2 != null; type2 = type2.BaseType)
{
for (int k = 0; k < list.Count; k++)
{
if (CustomEditorAttributes.IsAppropriateEditor(list[k], type2, type != type2, j == 1))
{
inspectorType = list[k].m_InspectorType;
dictionary.Add(type, inspectorType);
result = inspectorType;
return(result);
}
}
}
}
dictionary.Add(type, null);
result = null;
}
}
return(result);
}