예제 #1
0
    /// <summary>
    /// 下载差异资源
    /// </summary>
    public IEnumerator DownloadDiffFiles()
    {
        int count = 0;

        for (var idx = 0; idx < mDiffList.Count; ++idx)
        {
            var i         = mDiffList[idx];
            var subPath   = i.Replace("assets/appres/", "");
            var cachePath = AssetSys.CacheRoot + subPath;

            var dir = Path.GetDirectoryName(cachePath);
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            yield return(AssetSys.Download(subPath, subPath, fs =>
            {
                Updated(subPath);
                ++count;
                if (count == mDiffList.Count)
                {
                    mAllDownloadOK = true;
                }
            }));
        }
    }
예제 #2
0
    public IEnumerator GetRemoteVersion()
    {
        var remoteVersionUrl = AssetSys.WebRoot + AssetSys.PlatformName() + "/" + "resversion.txt";

        AppLog.d(Tag, remoteVersionUrl);

        var temp = Path.GetTempFileName().upath();

        yield return(AssetSys.Download(remoteVersionUrl, temp));

        mRemoteVersion = new Version(File.ReadAllText(temp));
        AppLog.d(Tag, "RemoteVersion {0}", mRemoteVersion.ToString());
        yield return(null);
    }
예제 #3
0
    public IEnumerator GetRemoteManifest()
    {
        var remoteManifestUrl = AssetSys.WebRoot + AssetSys.PlatformName() + "/" + mRemoteVersion + "/" + AssetSys.PlatformName();

        var old = AssetBundle.GetAllLoadedAssetBundles().ToList().Find(i => i.name == ""); //AssetBundleManifest);

        if (old)
        {
            AppLog.d(Tag, $"unload AssetBundleManifest {old.name}:{old}");
            old.Unload(true);
        }

        var temp = Path.GetTempFileName().upath();

        yield return(AssetSys.Download(remoteManifestUrl, temp, fs =>
        {
            mRemoteManifest = AssetBundle.LoadFromStream(fs).LoadAsset <AssetBundleManifest>("AssetBundleManifest");
        }));
    }