We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// 配置某Assembly下所有涉及到的delegate到CSharpCallLua下,Hotfix下拿不准那些delegate需要适配到lua function可以这么配置 [CSharpCallLua] static IEnumerable<Type> AllDelegate { get { BindingFlags flag = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; List<Type> allTypes = new List<Type>(); var allAssemblys = new Assembly[] { Assembly.Load("Assembly-CSharp") }; foreach (var t in from assembly in allAssemblys from type in assembly.GetTypes() select type) { var p = t; while (p != null) { allTypes.Add(p); p = p.BaseType; } } allTypes = allTypes.Distinct().ToList(); var allMethods = from type in allTypes from method in type.GetMethods(flag) select method; var returnTypes = from method in allMethods select method.ReturnType; var paramTypes = allMethods.SelectMany(m => m.GetParameters()).Select(pinfo => pinfo.ParameterType.IsByRef ? pinfo.ParameterType.GetElementType() : pinfo.ParameterType); var fieldTypes = from type in allTypes from field in type.GetFields(flag) select field.FieldType; return returnTypes.Concat(paramTypes).Concat(fieldTypes).Where(t => t.BaseType == typeof(MulticastDelegate) && !hasGenericParameter(t) && !delegateHasEditorRef(t)).Distinct(); } }
开启符号NOT_GEN_WARNING,然后运行Example/09_GenericMethod,会提示方法通过反射调用。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
开启符号NOT_GEN_WARNING,然后运行Example/09_GenericMethod,会提示方法通过反射调用。
The text was updated successfully, but these errors were encountered: