protected IEnumerator InitializeCroutine(AssetBundleManagerEvent <bool, AssetBundleManifest> onFinish = null)
    {
        DontDestroyOnLoad(gameObject);

#if UNITY_EDITOR
        Debug.Log("EventDrivenBaseLoader Mode:" + (AssetBundleManager.SimulateAssetBundleInEditor ?
                                                   "Editor Simulation" : "Normal"));
#endif

        AssetBundleManager.BaseDownloadingURL = new StringBuilder()
                                                .Append(GetRelativePath())
                                                .Append(kAssetBundlesPath)
                                                .Append(PlatformfolderForAssetBundles)
                                                .Append("/")
                                                .ToString();

        var request = AssetBundleManager.Initialize(PlatformfolderForAssetBundles);

        if (request != null)
        {
            yield return(GetDriver().StartCoroutine(request));
        }

        if (onFinish != null)
        {
            var manifest = request.GetAsset <AssetBundleManifest> ();
            onFinish(manifest != null, manifest);
        }
    }
    IEnumerator GetAssetsAsyncInternal <T> (string bundleName, string[] assetNames,
                                            AssetBundleManagerEvent <bool, T[]> callBack) where T : UnityEngine.Object
    {
        var operations = new List <AssetBundleLoadAssetOperation> ();

        foreach (var assetName in assetNames)
        {
            var request = AssetBundleManager.LoadAssetAsync(bundleName, assetName, typeof(T));
            operations.Add(request);
            yield return(GetDriver().StartCoroutine(request));
        }

        var isNullCount = operations.Count(operation => operation.GetAsset <T> () == null);
        var assets      = operations.Select(operation => operation.GetAsset <T> ())
                          .ToArray();

        AssetBundleManager.UnloadAssetBundle(bundleName);
        callBack(isNullCount == 0, assets);
    }
    IEnumerator GetAssetInternal <T> (string bundleName, string assetName,
                                      AssetBundleManagerEvent <bool, T> callBack) where T : UnityEngine.Object
    {
        AssetBundleLoadAssetOperation operation = AssetBundleManager.LoadAssetAsync(bundleName,
                                                                                    assetName, typeof(T));

        if (operation == null)
        {
            callBack(false, null);
            yield break;
        }

        yield return(GetDriver().StartCoroutine(operation));

        T asset = operation.GetAsset <T> ();

        var isSuccess = asset != null;

        AssetBundleManager.UnloadAssetBundle(bundleName);
        callBack(isSuccess, asset);
    }
 public void GetAssetAsync <T> (string bundleName, string assetName,
                                AssetBundleManagerEvent <bool, T> callBack) where T : UnityEngine.Object
 {
     GetDriver().StartCoroutine(GetAssetInternal <T> (bundleName, assetName, callBack));
 }
 public void Initialize(AssetBundleManagerEvent <bool, AssetBundleManifest> onFinish = null)
 {
     GetDriver().StartCoroutine(InitializeCroutine(onFinish));
 }