IEnumerator Start(UUIWorker _worker, Action <UUIWorker, GameObject> _callback)
        {
            yield return(Request);

            var template = Request.GetAsset <GameObject>();

            if (template != null)
            {
                UI = GameObject.Instantiate(template);
            }

            _callback.Invoke(_worker, UI);

            LastProgress = 0.1f;
            Request      = null;
        }
Example #2
0
        IEnumerator Start(UUIWorker _worker, Action <UUIInfo> _unloadCallback)
        {
            //> 等待UI加载完成
            yield return(_worker.Request);

            //> 如果这个UI有实例脚本
            if (_worker.Script != null)
            {
                yield return(new UAsyncOperationFuncBool(() => _worker.Script.CanDestroy));

                if (false == _worker.IsSceneObject)
                {
                    GameObject.Destroy(_worker.Script.Root);
                }

                _unloadCallback(_worker.Info);
            }
        }
 public UUIRequestBy(UResourceRequest _request, UUIWorker _worker, Action <UUIWorker, GameObject> _callback)
 {
     Request = _request;
     this.StartCoroutine(Start(_worker, _callback));
 }