IEnumerator DownLoadAsset(string assetName, DownLoadHelpAPI downLoadHelper) { string loadpath = string.Format("{0}/{1}", SimpleFactory.CreatePathHelperAPI().AppContentPath(), assetName); Debug.Log(loadpath); WWW assetData = new WWW(loadpath); yield return(assetData); // Debug.Log(loadpath); if (assetData.error != null) { Debug.Log(assetData.error); yield break; } AssetBundle assetBundle; if (assetData.isDone) { assetBundle = AssetBundle.LoadFromMemory(assetData.bytes); BundleReferenceAPI bundleReference = SimpleFactory.CreateBundleReferenceAPI(); bundleReference.InitBundle(assetBundle); bundlelist.Add(assetName, bundleReference); downLoadHelper.OnLoadAssetBundle(assetBundle); } yield return(null); }
public IEnumerator LoadAssetBundle(string keyName, DownLoadEventAPI combineLoadHelp) { AssetBundle assetBundle = null; bool hasBundle = bundlelist.ContainsKey(keyName) && bundlelist[keyName].Bundle != null; if (!hasBundle) { DownLoadHelpAPI downLoadHelp = SimpleFactory.CreateDownLoadHelpAPI(); yield return(DownLoadAsset(keyName, downLoadHelp)); } if (bundlelist.ContainsKey(keyName)) { assetBundle = bundlelist[keyName].PlusCount(); } if (assetBundle != null) { combineLoadHelp.OnLoadAssetBundle(assetBundle); } yield return(null); }