public AssetBundleLoader LoadAssetAsync(string assetPath, Action <AssetBundleInfo> OnComplete, bool isMulti = false, object param = null) { string filePath = AssetBundlePathResolver.GetAssetPath(assetPath.ToLower()); AssetBundleLoader bundleLoader = CreateAssetBundleLoader(filePath, param, isMulti, true); if (null == bundleLoader) { if (null != OnComplete) { OnComplete(null); } } else { allLoadSet.Add(bundleLoader); if (bundleLoader.IsComplete) { if (null != OnComplete) { bundleLoader.bundleInfo.param = param; OnComplete(bundleLoader.bundleInfo); } } else { if (null != OnComplete) { bundleLoader.onLoadComplete += OnComplete; } if (bundleLoader.state < EBundleLoadState.EState_Loading) { unCompleteLoadSet.Add(bundleLoader); } StartLoadBundle(); } } return(bundleLoader); }
public void LoadAssetSync(string assetPath, Action <AssetBundleInfo> OnComplete, bool isMulti = false, object param = null) { string filePath = AssetBundlePathResolver.GetAssetPath(assetPath.ToLower()); AssetBundleLoader bundleLoader = CreateAssetBundleLoader(filePath, param, isMulti, false); if (bundleLoader.IsComplete) { if (null != OnComplete) { OnComplete(bundleLoader.bundleInfo); } } else { if (null != OnComplete) { bundleLoader.onLoadComplete += OnComplete; } bundleLoader.LoadSync(); } }