Example #1
0
 /// <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);
     }
 }
Example #2
0
        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));
        }
Example #3
0
        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);
        }
Example #4
0
 public static void InvokeMethod(this object self, string methodName, bool isMissNotInvoke = true,
                                 params object[] parameters)
 {
     ReflectionUtil.Invoke <object>(self, methodName, isMissNotInvoke, parameters);
 }
Example #5
0
 public static void InvokeMethod(this object self, MethodInfo methodInfo, params object[] parameters)
 {
     ReflectionUtil.Invoke(self, methodInfo, parameters);
 }
Example #6
0
 public static T InvokeMethod <T>(this object self, string methodName, bool isMissNotInvoke = true,
                                  params object[] parameters)
 {
     return(ReflectionUtil.Invoke <T>(self, methodName, isMissNotInvoke, parameters));
 }
Example #7
0
 public static T InvokeMethod <T>(this object self, MethodInfo methodInfo, params object[] parameters)
 {
     return(ReflectionUtil.Invoke <T>(self, methodInfo, parameters));
 }