IEnumerator StartUpdate()
    {
        Debug.Log("start download : ");

        //先从网络下载 version 看是否需要下载
        WWW www = new WWW("http://127.0.0.1:8080/version.txt?name=xxx");

        yield return(www);

        Debug.Log("www : " + www.error);
        string downloadVersion = www.text;
        bool   isNeedDownload  = CheckVersion(downloadVersion);

        if (!isNeedDownload)
        {
            Finish();
            yield break;
        }

        //先从网络下载 file 列表文件 在本地进行比对 然后将改变的文件再次请求下载 最后更新
        //file 列表文件
        www = new WWW("http://127.0.0.1:8080/files.txt?name=xxx");

        yield return(www);

        string downloadFile = www.text;

        needDownloadFileList = new List <string>();
        CheckFiles(downloadFile);

        //开始进行逐个下载
        for (int i = 0; i < needDownloadFileList.Count; ++i)
        {
            var file = needDownloadFileList[i];
            Debug.Log("needDown : " + file);

            var url = "http://127.0.0.1:8080/" + file + "?name=xxx";
            Debug.Log("download : " + url);
            WWW fileWWW = new WWW(url);

            yield return(fileWWW);

            //simulate send update update state
            var info = UpdateResourceInfo.Create("", UpdateResourceStateType.UpdatingResource, 0.5f);
            updateCallback?.Invoke(info);

            var des = Const.AssetBundlePath + "/" + file;
            WriteFile(des, fileWWW.bytes);
        }

        //所有文件更新后 更新 files.txt 和 version.txt
        {
            var des = Const.AssetBundlePath + "/" + "files.txt";
            WriteFile(des, Encoding.UTF8.GetBytes(downloadFile));

            des = Const.AssetBundlePath + "/" + "version.txt";
            WriteFile(des, Encoding.UTF8.GetBytes(downloadVersion));
        }

        Finish();
    }
 internal void UpdateState(UpdateResourceInfo info)
 {
     //显示 进度 和 状态
     //拷贝游戏资源到持久化目录中 : 正在检查游戏资源 -> 正在解压资源(xxx.ab):20% -> 解压资源完成
     //更新游戏资源到持久化目录中 : 正在检查需要更新的游戏资源 -> 正在下载资源(xxxx.ab):15% -> 更新完成
 }