示例#1
0
        /// <summary>
        /// 下载完成
        /// </summary>
        void DownloadSucceed(string file_name)
        {
            lock (lock_obj_)
            {
                bool   is_compress = Compress.IsCompressFile(file_name);
                string assetbundle = is_compress ?
                                     Compress.GetDefaultFileName(file_name) : file_name;

                if (ImcompleteDownloads.Contains(assetbundle))
                {
                    ImcompleteDownloads.Remove(assetbundle);
                }
                CompleteDownloads.Add(assetbundle);

                //判断是否需要解压文件
                if (is_compress)
                {
                    // 解压文件
                    string in_file  = Root + "/" + file_name;
                    string out_file = Root + "/" + assetbundle;
                    Compress.DecompressFile(in_file, out_file);
                    // 删除压缩包
                    System.IO.File.Delete(in_file);
                }
            }
        }
示例#2
0
    /// <summary>
    /// 初始化下载信息
    /// </summary>
    void InitializeDownload(string root, List <string> assetbundles)
    {
        Root = root;
        ImcompleteDownloads = assetbundles;

        IsDone    = false;
        ErrorCode = EmErrorCode.None;
        CompleteDownloads.Clear();
        FailedDownloads.Clear();

        if (ImcompleteDownloads == null)
        {
            ImcompleteDownloads = new List <string>();
        }

        //统计数据
        TotalSize     = 0;
        CompletedSize = 1000;
        //for (int i = 0; i < ImcompleteDownloads.Count; ++i)
        //{
        //    var ab = resources_manifest_.Find(ImcompleteDownloads[i]);
        //    if (ab != null)
        //    {
        //        TotalSize += ab.Size;
        //    }
        //}
    }
示例#3
0
        /// <summary>
        /// 初始化下载信息
        /// </summary>
        void InitializeDownload(string root
                                , List <string> assetbundles
                                , ResourcesManifest resources_manifest)
        {
            Root = root;
            ImcompleteDownloads = assetbundles;
            resources_manifest_ = resources_manifest;

            IsDone    = false;
            ErrorCode = emErrorCode.None;
            CompleteDownloads.Clear();
            FailedDownloads.Clear();

            if (ImcompleteDownloads == null)
            {
                ImcompleteDownloads = new List <string>();
            }

            //统计数据
            TotalSize     = 0;
            CompletedSize = 0;
            for (int i = 0; i < ImcompleteDownloads.Count; ++i)
            {
                var ab = resources_manifest_.Find(ImcompleteDownloads[i]);
                if (ab != null)
                {
                    if (ab.IsCompress)
                    {
                        TotalSize += ab.CompressSize;
                    }
                    else
                    {
                        TotalSize += ab.Size;
                    }
                }
            }
        }