/// <summary> /// 通过Prefab创建AView对象 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="prefab">Prefab对象</param> /// <param name="parentView">作为父对象的AView</param> /// <param name="parentTransform">父Transform容器</param> /// <param name="data">携带的参数</param> /// <returns></returns> public static T Create <T>(GameObject prefab, AView parentView, Transform parentTransform, object data = null) where T : AView { AView view = AViewMgr.CreateViewFromPrefab(prefab, parentTransform, prefab.name, typeof(T)); parentView.AddChild(view); if (data != null) { view.SetData(data); } return(view as T); }