private IEnumerator asyncLoadBundle(UniResOperation _op, string _bundle, OnLoadBundleFinishDelegate _finish) { string dir = Application.streamingAssetsPath; if (externalBundles.Contains(_bundle)) { dir = Application.persistentDataPath; } if (!dir.Contains("file://")) { dir = dir.Insert(0, "file://"); } string path = System.IO.Path.Combine(dir, "res/" + _bundle); WWW www = new WWW(path); _op.Use(www); yield return(www); if (null != www.error) { this.LogError(www.error); yield break; } AssetBundle bundle = www.assetBundle; if (null == bundle) { this.LogError("bundle is null"); yield break; } bundles.Add(_bundle, bundle); www.Dispose(); _op.Use(1.0f); _finish(bundle); }
public static IResOpeartion AsyncLoadBundle(string _bundle, OnLoadBundleFinishDelegate _finish) { if (null == resLoaderImpl) { Log.Error("ResBundle", "resLoaderImpl is null"); return(null); } return(resLoaderImpl.AsyncLoadBundle(_bundle, _finish)); }
private static void addBundleTask(string _bundle, OnLoadBundleFinishDelegate _onFinish) { Task task = new Task(); task.bundle = _bundle; task.res = ""; task.type = Task.TYPE_BUNDLE; task.onBundleFinish = _onFinish; tasks.Enqueue(task); }
public IResOpeartion AsyncLoadBundle(string _bundle, OnLoadBundleFinishDelegate _finish) { UniResOperation op = new UniResOperation(); if (!bundles.ContainsKey(_bundle)) { this.LogDebug("Load Bundle {0} ... ", _bundle); mono.StartCoroutine(asyncLoadBundle(op, _bundle, (_ab) => { this.LogDebug("Load Bundle {0} finish", _bundle); _finish(_ab); })); } else { op.Use(1.0f); this.LogDebug("Load exits Bundle {0}", _bundle); _finish(bundles [_bundle]); } return(op); }
public static void AddBundleTask(string _bundle, OnLoadBundleFinishDelegate _onFinish) { addBundleTask(_bundle, _onFinish); }