/// <summary> /// 调用callMethod的方法 /// </summary> /// <param name="gameObject"></param> /// <param name="invokeMethodName"></param> /// <param name="excludeComponentTypes"></param> /// <param name="parameters"></param> public static void Invoke(GameObject gameObject, string invokeMethodName, string excludeComponentTypes = null, params object[] parameters) { foreach (var component in gameObject.GetComponentsExclude(excludeComponentTypes)) { ReflectionUtil.Invoke(component, invokeMethodName, true, parameters); } }
public static T InvokeExtension <T>(object obj, string fullClassPath, string methodInfoString, bool isMissNotInvoke = true, params object[] parameters) { parameters = parameters.ToList().AddFirst(obj).ToArray(); MethodInfo methodInfo = GetExtensionMethodInfo(fullClassPath, methodInfoString, ReflectionUtil.GetReflectionType(obj).Assembly, parameters); return(methodInfo == null && isMissNotInvoke ? default(T) : ReflectionUtil.Invoke <T>(obj, methodInfo, parameters)); }
public static void InvokeExtension(object obj, string fullClassPath, string methodInfoString, bool isMissNotInvoke = true, params object[] parameters) { parameters = parameters.ToList().AddFirst(obj).ToArray(); MethodInfo methodInfo = GetExtensionMethodInfo(fullClassPath, methodInfoString, ReflectionUtil.GetReflectionType(obj).Assembly.FullName, parameters); if (methodInfo == null && isMissNotInvoke) { return; } ReflectionUtil.Invoke <object>(obj, methodInfo, parameters); }
public static void InvokeMethod(this object self, string methodName, bool isMissNotInvoke = true, params object[] parameters) { ReflectionUtil.Invoke <object>(self, methodName, isMissNotInvoke, parameters); }
public static void InvokeMethod(this object self, MethodInfo methodInfo, params object[] parameters) { ReflectionUtil.Invoke(self, methodInfo, parameters); }
public static T InvokeMethod <T>(this object self, string methodName, bool isMissNotInvoke = true, params object[] parameters) { return(ReflectionUtil.Invoke <T>(self, methodName, isMissNotInvoke, parameters)); }
public static T InvokeMethod <T>(this object self, MethodInfo methodInfo, params object[] parameters) { return(ReflectionUtil.Invoke <T>(self, methodInfo, parameters)); }