/// <summary>
    /// 单个资源热更下载完成回调
    /// </summary>
    /// <param name="url">下载地址</param>
    /// <param name="downloadhandler">下载结果信息</param>
    /// <param name="requeststatus">请求结果</param>
    private void singleResourceHotUpdateCompleteCB(string url, DownloadHandler downloadhandler, TWebRequest.WebRequestTaskInfo.WebTaskRequestStatus requeststatus)
    {
        Debug.Log(string.Format("资源 : {0}下载返回!", url));
        var resname    = Path.GetFileName(url);
        var resversion = int.Parse(Path.GetFileName(Path.GetDirectoryName(url)));

        if (requeststatus == TWebRequest.WebRequestTaskInfo.WebTaskRequestStatus.WT_Complete)
        {
            Debug.Log(string.Format("资源版本号 : {0} 资源名 : {1}热更下载成功!", resversion, resname));
            //存储热更资源到包外并记录热更资源信息
            saveHotResourceUpdate(resname, resversion, downloadhandler.data);
            mNeedHotUpdateResourceMap[resversion].Remove(resname);
            if (mNeedHotUpdateResourceMap[resversion].Count == 0)
            {
                mNeedHotUpdateResourceMap.Remove(resversion);
            }
            Debug.Log(string.Format("当前资源热更进度 : {0}", HotResourceUpdateProgress));
            if (mNeedHotUpdateResourceMap.Count == 0)
            {
                Debug.Log("资源热更完成!");
                mResourceHotUpdateCompleteCB(true);
                mResourceHotUpdateCompleteCB = null;
                VersionConfigModuleManager.Singleton.saveNewResoueceCodeConfig(NewHotUpdateResourceCode);
            }
        }
        else
        {
            Debug.LogError(string.Format("资源 : {0}热更下载失败!", resname));
            mHotResourceUpdateRequest.stopRequest();
            mResourceHotUpdateCompleteCB(false);
            mResourceHotUpdateCompleteCB = null;
        }
    }
 /// <summary>
 /// 版本强更下载完成回调
 /// </summary>
 /// <param name="url">下载地址</param>
 /// <param name="downloadhandler">下载结果数据</param>
 /// <param name="requeststatus">下载状态</param>
 private void versionHotUpdateCompleteCB(string url, DownloadHandler downloadhandler, TWebRequest.WebRequestTaskInfo.WebTaskRequestStatus requeststatus)
 {
     Debug.Log(string.Format("版本强更资源地址 : {0}", url));
     if (requeststatus == TWebRequest.WebRequestTaskInfo.WebTaskRequestStatus.WT_Complete)
     {
         Debug.Log(string.Format("版本强更资源下载成功!版本强更资源信息 : {0}", downloadhandler.text));
         try
         {
             Debug.Log("安装包下载完成!");
             if (!Directory.Exists(VersionHotUpdateCacheFolderPath))
             {
                 Directory.CreateDirectory(VersionHotUpdateCacheFolderPath);
             }
             if (File.Exists(VersionHotUpdateCacheFilePath))
             {
                 File.Delete(VersionHotUpdateCacheFilePath);
             }
             using (var fs = File.Create(VersionHotUpdateCacheFilePath))
             {
                 fs.Write(downloadhandler.data, 0, downloadhandler.data.Length);
                 fs.Flush();
                 fs.Close();
                 Debug.Log(VersionHotUpdateCacheFilePath + "文件写入完成!");
                 mVersionHotUpdateCompleteCB(true);
             }
         }
         catch (Exception e)
         {
             Debug.LogError(string.Format("版本强更资源异常 : {0}!", e.Message));
             Debug.LogError("版本强更失败!");
             mVersionHotUpdateCompleteCB(false);
         }
         finally
         {
             mVersionHotUpdateCompleteCB = null;
         }
     }
     else
     {
         Debug.LogError("版本强更资源下载失败!");
         mVersionHotUpdateCompleteCB(false);
         mVersionHotUpdateCompleteCB = null;
     }
 }
    /// <summary>
    /// 热更资源列表下载完成回调
    /// </summary>
    /// <param name="url">下载地址</param>
    /// <param name="downloadhandler">下载结果数据</param>
    /// <param name="requeststatus">下载状态</param>
    private void resourceListHotUpdateCompleteCB(string url, DownloadHandler downloadhandler, TWebRequest.WebRequestTaskInfo.WebTaskRequestStatus requeststatus)
    {
        Debug.Log(string.Format("热更资源列表地址 : {0}", url));
        if (requeststatus == TWebRequest.WebRequestTaskInfo.WebTaskRequestStatus.WT_Complete)
        {
            Debug.Log(string.Format("热更资源列表下载成功!热更资源列表信息 : {0}", downloadhandler.text));
            mNeedHotUpdateResourceMap.Clear();
            mHotUpdateResourceTotalNumber = 0;

            //TODO:
            //结合服务器上的资源MD5信息做资源验证,确保资源下对以及未被修改
            var hotupdateresourcesmap  = new SortedDictionary <int, List <string> >();
            var hotupdateresourcesinfo = downloadhandler.text.Split(';');
            try
            {
                foreach (var hotupdatereousrceinfo in hotupdateresourcesinfo)
                {
                    //避免最后添加;后导致多一个空数据报错
                    if (hotupdatereousrceinfo.IsNullOrEmpty())
                    {
                        continue;
                    }
                    var           resourceinfo = hotupdatereousrceinfo.Split(':');
                    var           resversion   = int.Parse(resourceinfo[0]);
                    var           resname      = resourceinfo[1];
                    List <string> reslist;
                    if (!hotupdateresourcesmap.TryGetValue(resversion, out reslist))
                    {
                        reslist = new List <string>();
                        hotupdateresourcesmap.Add(resversion, reslist);
                    }
                    if (!reslist.Contains(resname))
                    {
                        reslist.Add(resname);
                        Debug.Log(string.Format("添加需要热更的资源信息,版本号 : {0}, 资源名 : {1}", resversion, resname));
                    }
                    else
                    {
                        Debug.LogError(string.Format("重复的资源热更信息!版本号 : {0} 资源名 : {1}!", resversion, resname));
                    }
                }
                //根据返回的热更资源数据结合本地资源版本号以及已经热更下载的资源计算出剩下需要热更的资源数据
                var currentresversion = VersionConfigModuleManager.Singleton.GameVersionConfig.ResourceVersionCode;
                foreach (var hotupdateresourceinfo in hotupdateresourcesmap)
                {
                    List <string> alreadyupdatedreslist;
                    if (!mLocalUpdatedResourceMap.TryGetValue(hotupdateresourceinfo.Key, out alreadyupdatedreslist))
                    {
                        alreadyupdatedreslist = new List <string>();
                    }
                    if (hotupdateresourceinfo.Key > currentresversion)
                    {
                        foreach (var hotupdateresource in hotupdateresourceinfo.Value)
                        {
                            if (alreadyupdatedreslist.Contains(hotupdateresource))
                            {
                                Debug.Log(string.Format("资源已经热更过了: 资源版本号:{0} 资源名:{1}", hotupdateresourceinfo.Key, hotupdateresource));
                            }
                            else
                            {
                                List <string> neddhotupdatereslist;
                                if (!mNeedHotUpdateResourceMap.TryGetValue(hotupdateresourceinfo.Key, out neddhotupdatereslist))
                                {
                                    neddhotupdatereslist = new List <string>();
                                    mNeedHotUpdateResourceMap.Add(hotupdateresourceinfo.Key, neddhotupdatereslist);
                                }
                                if (!neddhotupdatereslist.Contains(hotupdateresource))
                                {
                                    neddhotupdatereslist.Add(hotupdateresource);
                                    mHotUpdateResourceTotalNumber++;
                                    Debug.Log(string.Format("添加需要热更的资源信息,版本号 : {0}, 资源名 : {1}", hotupdateresourceinfo.Key, hotupdateresource));
                                }
                            }
                        }
                    }
                }
                Debug.Log(string.Format("需要热更的资源数 : {0}", mHotUpdateResourceTotalNumber));
                foreach (var needhotupdateresinfo in mNeedHotUpdateResourceMap)
                {
                    foreach (var needhotupdateres in needhotupdateresinfo.Value)
                    {
                        Debug.Log(string.Format("需要热更的资源信息 : 资源版本号:{0} 资源名:{1}", needhotupdateresinfo.Key, needhotupdateres));
                    }
                }

                if (mHotUpdateResourceTotalNumber > 0)
                {
                    //开始资源热更
                    //检查资源热更目录,不存在就创建一个
                    AssetBundlePath.CheckAndCreateABOutterPathFolder();
                    //检查资源热更列表信息目录
                    if (!Directory.Exists(LocalResourceUpdateListFilFolderPath))
                    {
                        Directory.CreateDirectory(LocalResourceUpdateListFilFolderPath);
                        Debug.Log(string.Format("创建目录 : {0}", LocalResourceUpdateListFilFolderPath));
                    }
                    foreach (var resinfo in mNeedHotUpdateResourceMap)
                    {
                        foreach (var res in resinfo.Value)
                        {
                            //URL = 基础URL + 当前版本号 + "/" + 需要热更的资源版本号 + "/" + 需要热更的资源名
                            var finalurl = mHotUpdateURL + VersionConfigModuleManager.Singleton.GameVersionConfig.VersionCode.ToString("0.0") + "/" + resinfo.Key + "/" + res;
                            mHotResourceUpdateRequest.enqueue(finalurl, singleResourceHotUpdateCompleteCB);
                        }
                    }
                    mHotResourceUpdateRequest.startRequest();
                }
                else
                {
                    Debug.Log("没有资源需要热更,直接进入游戏!");
                    mResourceHotUpdateCompleteCB(true);
                    mResourceHotUpdateCompleteCB = null;
                }
            }
            catch (Exception e)
            {
                Debug.LogError(string.Format("热更资源异常 : {0}!", e.Message));
                Debug.LogError("热更资源失败!");
                mHotResourceUpdateRequest.stopRequest();
                mResourceHotUpdateCompleteCB(false);
                mResourceHotUpdateCompleteCB = null;
            }
            finally
            {
            }
        }
        else
        {
            Debug.LogError("热更资源列表下载失败!");
            mResourceHotUpdateCompleteCB(false);
            mResourceHotUpdateCompleteCB = null;
        }
    }
 /// <summary>
 /// 服务器版本信息拉去回调
 /// </summary>
 /// <param name="url">下载地址</param>
 /// <param name="downloadhandler">下载结果数据</param>
 /// <param name="requeststatus">下载状态</param>
 private void serverVersionConfigCompleteCB(string url, DownloadHandler downloadhandler, TWebRequest.WebRequestTaskInfo.WebTaskRequestStatus requeststatus)
 {
     Debug.Log(string.Format("服务器版本信息资源列表地址 : {0}", url));
     if (requeststatus == TWebRequest.WebRequestTaskInfo.WebTaskRequestStatus.WT_Complete)
     {
         Debug.Log(string.Format("服务器版本信息资源下载成功!服务器版本信息 : {0}", downloadhandler.text));
         ServerVersionConfig = JsonUtility.FromJson <VersionConfig>(downloadhandler.text);
         Debug.Log($"服务器版本信息:VersionCode : {ServerVersionConfig.VersionCode} ResourceVersionCode: {ServerVersionConfig.ResourceVersionCode}");
         mServerVersionConfigHotUpdateCompleteCB?.Invoke(true);
     }
     else
     {
         Debug.LogError("服务器版本信息资源下载失败!");
         mServerVersionConfigHotUpdateCompleteCB?.Invoke(false);
         mServerVersionConfigHotUpdateCompleteCB = null;
     }
 }