Пример #1
0
    public IEnumerator AssetBundle_CachedBundleNames()
    {
        var listDownloaded = false;

        Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
            status =>
        {
            listDownloaded = true;
        },
            (error, reason, status) =>
        {
        }
            );
        yield return(WaitUntil(
                         () => listDownloaded,
                         () => { throw new TimeoutException("failed to download list."); }
                         ));

        var done = false;

        Autoya.AssetBundle_CachedBundleNames(
            names =>
        {
            True(!names.Any());
            done = true;
        },
            (error, reason) =>
        {
        }
            );

        yield return(WaitUntil(
                         () => done,
                         () => { throw new TimeoutException("failed to get cached bundle names in time."); }
                         ));
    }
Пример #2
0
    public IEnumerator AssetBundle_CachedBundleNamesWillBeUpdated()
    {
        var listDownloaded = false;

        Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
            status =>
        {
            listDownloaded = true;
        },
            (error, reason, status) =>
        {
        }
            );
        yield return(WaitUntil(
                         () => listDownloaded,
                         () => { throw new TimeoutException("failed to download list."); }
                         ));

        // load 1 asset.
        var done      = false;
        var assetName = string.Empty;

        Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
            status =>
        {
            assetName = Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().assetBundles[0].assetNames[0];
            Autoya.AssetBundle_LoadAsset <GameObject>(
                assetName,
                (name, asset) =>
            {
                // succeeded to download AssetBundle and got asset from AB.
                done = true;
            },
                (name, error, reason, autoyaStatus) =>
            {
            }
                );
        },
            (code, reason, asutoyaStatus) =>
        {
            Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
        }
            );

        yield return(WaitUntil(
                         () => done,
                         () => { throw new TimeoutException("faild to get assetBundleList."); }
                         ));

        var done2 = false;

        Autoya.AssetBundle_CachedBundleNames(
            names =>
        {
            True(names.Any());
            done2 = true;
        },
            (error, reason) =>
        {
        }
            );

        yield return(WaitUntil(
                         () => done2,
                         () => { throw new TimeoutException("failed to get cached bundle names in time."); }
                         ));
    }