Example #1
0
 /// <summary>
 /// 构造
 /// </summary>
 /// <param name="trans"></param>
 public ATComponent(Transform trans)
 {
     this.Transform = trans;
     //创建State
     this.Props = new T();
     UFlux.InitComponent(this);
 }
Example #2
0
        /// <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.InitComponent(this);
            //初始化
            this.Init();
        }
Example #3
0
 /// <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.InitComponent(this);
         //初始化
         Init();
         if (callback != null)
         {
             callback();
         }
     });
 }