var attributes = mrd.Obj.GetType().GetAttribute<PropertyPanelAttribute>();
if(attributes != null&& attributes.UIPanelName!=null)
{
Type t = attributes.UIPanelName;
MethodInfo mtinfo= Type.GetType("UIManager").GetMethod("OpenUI").MakeGenericMethod(t);
mtinfo.Invoke(UIManager.Instance, new object[] { UIOpenType.ResetAndCloseSameType, new object[] { mrd.Obj, false } });
}
发射调用单例里面泛型的方法
获取方法后设置泛型时一定要重新赋值
MethodInfo mtinfo= Type.GetType("UIManager").GetMethod("OpenUI").MakeGenericMethod(t);
MethodInfo mtinfo= Type.GetType("UIManager").GetMethod("OpenUI");
mtinfo=mtinfo.MakeGenericMethod(t)
错误栗子:
MethodInfo mtinfo= Type.GetType("UIManager").GetMethod("OpenUI");
mtinfo.MakeGenericMethod(t)