Beispiel #1
0
    public IEnumerator GetPreloadingAssetBundleWeight()
    {
        var doneCount = 0;

        yield return(assetBundlePreloader.Preload(
                         loader,
                         preloadListDlPath + "sample.preloadList2.json",
                         (willLoadBundleNames, proceed, cancel) =>
        {
            True(0 < willLoadBundleNames.Length);
            var totalWeight = loader.GetAssetBundlesWeight(willLoadBundleNames);
            True(0 < totalWeight);
            proceed();
        },
                         progress =>
        {
            doneCount++;
        },
                         () =>
        {
            // do nothng.
        },
                         (code, reason, autoyaStatus) =>
        {
            Debug.LogError("failed to download, code:" + code + " reason:" + reason);
        },
                         (preloadFailedAssetBundleName, code, reason, autoyaStatus) =>
        {
            Debug.LogError("failed to download, name:" + preloadFailedAssetBundleName + " code:" + code);
        }
                         ));

        WaitUntil(() => doneCount == 2, () => { throw new TimeoutException("not yet done. doneCount:" + doneCount); });
    }