string spacename_classname;//空间名.类型名
string way_name;//方法名
Type[] types;//方法参数类型数组
Get_method();//返回方法相关信息,method为方法,obj为方法调用所需,id为方法顺序号,便于添加方法集合数组等
using System;
using System.Reflection;
namespace Assets.Scenes
{
class Method_save
{
public MethodInfo method;
public System.Object obj;
public int id;
public Method_save(MethodInfo a, System.Object b)
{
method = a; obj = b;
}
public Method_save(MethodInfo a, System.Object b, int i)
{
method = a; obj = b; id = i;
}
public static Method_save Get_method(string spacename_classname, string way_name, Type[] types)
{
Type type = Type.GetType(spacename_classname);
System.Object obj = System.Activator.CreateInstance(type);
MethodInfo method = type.GetMethod(way_name, types);
Method_save a = new Method_save(method, obj);
return a;
}
public static Method_save Get_method(string spacename_classname, string way_name, Type[] types, int id)
{
Type type = Type.GetType(spacename_classname);
System.Object obj = System.Activator.CreateInstance(type);
MethodInfo method = type.GetMethod(way_name, types);
Method_save a = new Method_save(method, obj, id);
return a;
}
}
}