/// <summary> /// 构造 /// </summary> /// <param name="trans"></param> public Component(Transform trans) { this.Transform = trans; //创建State this.Props = new T(); UFlux.SetTransformPath(this); }
/// <summary> /// 加载接口 /// </summary> public void Load() { if (resPath == null) { return; } var o = UFlux.Load <GameObject>(resPath); this.Transform = GameObject.Instantiate(o).transform; this.IsLoad = true; UFlux.SetTransformPath(this); //初始化 this.Init(); }
/// <summary> /// 异步加载 /// </summary> /// <param name="callback"></param> public void AsyncLoad(Action callback = null) { if (resPath == null) { return; } UFlux.AsyncLoad <GameObject>(resPath, obj => { this.Transform = GameObject.Instantiate(obj).transform; this.IsLoad = true; UFlux.SetTransformPath(this); //初始化 Init(); if (callback != null) { callback(); } }); }