private void loadNext()
        {
            int hasCount = queue.Count;

            if (running == 0 && hasCount == 0)
            {
                this.simpleDispatch(EventX.COMPLETE);
                return;
            }

            while (running < threadCount && hasCount > 0)
            {
                AssetResource resource = queue.Dequeue();
                runningList.Add(resource);
                resource.addEventListener(EventX.COMPLETE, itemComplete);
                resource.addEventListener(EventX.FAILED, itemComplete);
                //resource.addEventListener(AssetEvent.PROGRESS, itemProgress);
                running++;
                hasCount--;
                newRunnigList.Add(resource);
            }
            int len = newRunnigList.Count;

            for (int i = 0; i < len; i++)
            {
                newRunnigList[i].load(0, false, retryCount);
            }
            newRunnigList.Clear();
        }
Esempio n. 2
0
        private void _doNext()
        {
            if (isComplete)
            {
                return;
            }
            testCount++;
            if (queue.Count == 0 && running == 0 && isComplete == false)
            {
                isComplete = true;
                Log("QuComplete");
                this.simpleDispatch(EventX.COMPLETE);
                return;
            }

            while (queue.Count > 0 && running < threadCount)
            {
                AssetResource resource = queue.Dequeue();
                runningList.Add(resource);

                running++;
                Log("QuStart: {0} {1}", running, resource.url);

                AssetsManager.bindEventHandle(resource, itemComplete);
                resource.addEventListener(EventX.DISPOSE, itemComplete);
                resource.addEventListener(EventX.PROGRESS, itemProgress);
                resource.load(retryCount, false);
            }
        }
        protected override void _loadImp(int priority = 0, bool progress = false, uint retryCount = 0)
        {
            this.isProgress = progress;
            string manifesURI = "/" + manifesKey + "/";
            int    len        = manifesURI.Length;

            if (string.IsNullOrEmpty(manifesKey))
            {
                throw new Exception("不正常");
            }

            int index = url.IndexOf(manifesURI);

            manifesPrefix = url.Substring(0, index + len);

            dependKey = url.Substring(index + len);

            manifesURI = manifesKey + ".manifest";
            string        manifesURL = manifesPrefix + manifesKey;
            AssetResource resource   = AssetsManager.getResource(manifesURL, manifesURI, LoaderXDataType.MANIFEST);

            if (progress)
            {
                resource.addEventListener(EventX.PROGRESS, progressHandle);
            }
            AssetsManager.bindEventHandle(resource, manifesHandle);
            resource.load(3);

            return;
        }