예제 #1
0
    public void StartUpdate()
    {
        Debug.Log("==开始更新==");
        Debug.Log("下载根目录:" + loadRootPath);
        Debug.Log("保存根目录:" + saveRootPath);

        AssetBundle manifestAB;

        if (File.Exists(FilePathTools.manifestPath))
        {
            manifestAB  = AssetBundle.LoadFromFile(FilePathTools.manifestPath);
            oldManifest = manifestAB.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
            manifestAB.Unload(false);
        }
        else
        {
            Debug.Log("-本地没有版本文件-" + FilePathTools.manifestPath);
        }

        //GameMainManager.instance.mono.StartCoroutine(loadMainVerson());
        //下载主版本文件
        string path = FilePathTools.GetDownLoadMainVersonPath(verMainName);

        AssetLoadManager.Instance.LoadAsset <byte[]>(path, (bytes) => {
            Debug.Log("-下载远程版本文件成功-" + path);
            manifestBytes = bytes;


            manifestAB  = AssetBundle.LoadFromMemory(bytes);
            newManifest = manifestAB.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
            manifestAB.Unload(false);
            UpdateFiles();
        }, false);
    }