示例#1
0
        protected override IEnumerator InvokeLoadComplete(byte[] bytes)
        {
            _www = new WWW(new StringBuilder(App.pathManager.persistentDataPathWWW).Append(_urlRelative).ToString());

            while (_www.isDone == false)
            {
                yield return(null);
            }

            yield return(_www);

            if (_www == null)
            {
                _error = "loadContentIsNull";
                if (_errorCallback != null)
                {
                    _errorCallback.Invoke(this);
                }

                yield break;
            }

            if (_www.error != null)
            {
                if (Retry())
                {
                    yield break;
                }
                _error = _www.error;
                if (_errorCallback != null)
                {
                    _errorCallback.Invoke(this);
                }
            }
            else
            {
                UpdateProgress(1f);
                _stats.Done();

                OnLoadComplete();

                if (_data != null)
                {
                    _asset = AssetFactory.CreateAsset(_type, _data);
                }

                if (_completeCallback != null)
                {
                    _completeCallback.Invoke(this);
                }
            }

            if (_www != null)
            {
                //_www.Dispose();
                _www = null;
            }
        }
示例#2
0
        protected override IEnumerator InvokeLoadComplete(byte[] bytes)
        {
            AssetBundleCreateRequest abcr;

            if (bytes != null)
            {
                abcr = AssetBundle.LoadFromMemoryAsync(bytes);
            }
            else
            {
                abcr = AssetBundle.LoadFromFileAsync(new StringBuilder(App.pathManager.persistentDataPathFile).Append(_urlRelative).ToString());
            }

            while (abcr.isDone == false)
            {
                yield return(null);
            }
            _assetBundle = abcr.assetBundle;

            if (_assetBundle == null)
            {
                _error = "loadContentIsNull";
                if (_errorCallback != null)
                {
                    _errorCallback.Invoke(this);
                }

                yield break;
            }

            UpdateProgress(1f);
            _stats.Done();

            OnLoadComplete();

            if (_data != null)
            {
                _asset = AssetFactory.CreateAsset(_type, _data, _assetBundle);
            }

            if (_completeCallback != null)
            {
                _completeCallback.Invoke(this);
            }
        }