internal static string[] GetShaderIncludePaths() { if (ShaderImporterInspector.s_ShaderIncludePaths == null) { List <string> list = new List <string>(); AttributeHelper.MethodInfoSorter methodsWithAttribute = AttributeHelper.GetMethodsWithAttribute <ShaderIncludePathAttribute>(BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (AttributeHelper.MethodWithAttribute current in methodsWithAttribute.methodsWithAttributes) { if (current.info.ReturnType == typeof(string[]) && current.info.GetParameters().Length == 0) { string[] array = current.info.Invoke(null, new object[0]) as string[]; if (array != null) { list.AddRange(array); } } } ShaderImporterInspector.s_ShaderIncludePaths = list.ToArray(); } return(ShaderImporterInspector.s_ShaderIncludePaths); }
internal static Rect DrawEditorHeaderItems(Rect rectangle, Object[] targetObjs) { if (targetObjs.Length == 0 || (targetObjs.Length == 1 && targetObjs[0].GetType() == typeof(System.Object))) { return(rectangle); } if (s_EditorHeaderItemsMethods == null) { List <Type> targetObjTypes = new List <Type>(); var type = targetObjs[0].GetType(); while (type.BaseType != null) { targetObjTypes.Add(type); type = type.BaseType; } AttributeHelper.MethodInfoSorter methods = AttributeHelper.GetMethodsWithAttribute <EditorHeaderItemAttribute>(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly); Func <EditorHeaderItemAttribute, bool> filter = (a) => targetObjTypes.Any(c => a.TargetType == c); var methodInfos = methods.FilterAndSortOnAttribute(filter, (a) => a.callbackOrder); s_EditorHeaderItemsMethods = new List <HeaderItemDelegate>(); foreach (MethodInfo methodInfo in methodInfos) { s_EditorHeaderItemsMethods.Add((HeaderItemDelegate)Delegate.CreateDelegate(typeof(HeaderItemDelegate), methodInfo)); } } for (var index = 0; index < s_EditorHeaderItemsMethods.Count; index++) { HeaderItemDelegate dele = s_EditorHeaderItemsMethods[index]; if (dele(rectangle, targetObjs)) { rectangle.x -= rectangle.width; } } return(rectangle); }