Beispiel #1
0
    public IEnumerator AssetBundle_NotCachedBundleNamesInSomeAssetCached()
    {
        // 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."); }
                         ));

        // 1 or more assets are cached.(by dependencies.)


        string[] names = null;
        Autoya.AssetBundle_NotCachedBundleNames(
            bundleNames =>
        {
            names = bundleNames;
        },
            (error, reason) =>
        {
            Debug.Log("error:" + error + " reason:" + reason);
        }
            );

        yield return(WaitUntil(
                         () => names != null && 0 < names.Length,
                         () => { throw new TimeoutException("failed to get Not chached bundle names."); }
                         ));

        // 1 or more assets are cached.(by dependencies.)
        var wholeAssetBundleNames = Autoya.AssetBundle_AssetBundleLists().SelectMany(list => list.assetBundles).Select(bundleInfo => bundleInfo.bundleName).ToArray();

        True(names.Length < wholeAssetBundleNames.Length);
        True(!names.Contains(assetName), "cotntains.");
    }
Beispiel #2
0
    public IEnumerator AssetBundle_NotCachedBundleNames()
    {
        var listDownloaded = false;

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

        string[] names = null;
        Autoya.AssetBundle_NotCachedBundleNames(
            bundleNames =>
        {
            names = bundleNames;
        },
            (error, reason) =>
        {
            Debug.Log("error:" + error + " reason:" + reason);
        }
            );

        yield return(WaitUntil(
                         () => names != null && 0 < names.Length,
                         () => { throw new TimeoutException("failed to get Not chached bundle names."); }
                         ));

        // no asset cached.
        var wholeAssetBundleNames = Autoya.AssetBundle_AssetBundleLists().SelectMany(list => list.assetBundles).Select(bundleInfo => bundleInfo.bundleName).ToArray();

        True(names.Length == wholeAssetBundleNames.Length);
    }