Пример #1
0
    public void InitializeData()
    {
        if (_cache_server_data.Count <= 0)
        {
            return;
        }

        int i          = StartIndex;
        int queueIndex = 0;
        Dictionary <string, List <AssetDataInfo> > packages = new Dictionary <string, List <AssetDataInfo> >();

        var itr = _cache_server_data.Keys.GetEnumerator();

        while (itr.MoveNext())
        {
            Queue <AssetDataInfo> datas = _cache_server_data[itr.Current];
            downloadQueue.Add(new Queue <AssetDownInfo>());

            while (datas.Count > 0)
            {
                AssetDataInfo serverInfo = datas.Dequeue();
                UpdateStageResult.DownLoad.TotalSize += serverInfo.Size;
                UpdateStageResult.DownLoad.FileCount++;

                if (IsDownloaded(serverInfo) ||
                    IsCompressed(serverInfo))
                {
                    UpdateStageResult.DownLoad.CurrentSize += serverInfo.Size;
                    UpdateStageResult.DownLoad.CurrentCount++;
                    continue;
                }

                AssetDownInfo download = serverInfo.ToAssetDownInfo(i);
                download.QueueIndex = queueIndex;
                download.Version    = itr.Current;

                if (!VersionRecord.ContainsKey(itr.Current))
                {
                    VersionRecord.Add(itr.Current, 0);
                }
                VersionRecord[itr.Current]++;

                InitDownLoadInfo(download);
                OnAddAssets(itr.Current, download);

                downloadQueue[downloadQueue.Count - 1].Enqueue(download);
                i++;
            }
            queueIndex++;
        }
        itr.Dispose();

        _cache_server_data.Clear();
    }
    public ZipDecompressStage(StageDataBase stage)
    {
        _owner            = stage;
        _decompress_queue = new List <AssetDownInfo>();
        List <AssetDataInfo> localAllZip = FileManifestManager.LocalFenBao.GetAllZip();

        if (localAllZip == null)
        {
            return;
        }

        for (int i = 0; i < localAllZip.Count; i++)
        {
            AssetDataInfo dataInfo = localAllZip[i];
            _decompress_queue.Add(dataInfo.ToAssetDownInfo(i));
        }
        _index = localAllZip.Count;
    }