Esempio n. 1
0
 /// <summary>
 /// 加载完成
 /// </summary>
 private void OnLoadOneComplete()
 {
     try
     {
         _resRef.res.SetLoadingState(ELoadingState.Loaded);
         _resRef.OnComplete();
     }
     catch (Exception e)
     {
         Debug.LogErrorFormat("OnLoadOneComplete {0} Exception!", _resRef.url);
         Debug.LogException(e);
     }
     finally
     {
         _resRef = ResRef.Null;
         _www.Dispose();
         _www = null;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 取下一个资源
        /// </summary>
        private bool PeekNextRes(out ResRef r)
        {
            r = ResRef.Null;
            var count = _loadingResources.Count;

            if (count < 1)
            {
                if (_startLoadTime > MathUtil.fEpsilon)
                {
                    _startLoadTime = 0;
                }
                return(false);
            }

            LinkedListNode <ResRef> temp = null;
            LinkedListNode <ResRef> node = _loadingResources.First;

            while (node != null)
            {
                r = node.Value;
                if (null == r.res)
                {
                    if (!IsAllPipelineIdle())
                    {
                        _isBlocking = true;
                        return(false);
                    }

                    r.OnComplete();

                    temp = node;
                    node = node.Next;
                    _loadingResources.Remove(temp);
                    temp = null;
                    continue;
                }

                if (r.res.isPeeking)
                {
                    node = node.Next;
                    continue;
                }

                if (r.res.isLoading)
                {
                    node = node.Next;
                    continue;
                }

                temp = node;
                node = node.Next;
                _loadingResources.Remove(temp);
                temp = null;
                ++_loadingIndex;
                if (r.res.isLoaded)
                {
                    r.OnComplete();
                    continue;
                }

                r.res.SetLoadingState(ELoadingState.Peek);
                return(true);
            }
            return(false);
        }