public static UnityEngine.Object SyncLoadForAssets(string pathname) { if (Mode == ABLoaderMode.Self) { if (!ResBundleMgr.mIns.Cache.ContainsLoading(pathname)) { SyncLoader loader = BaseBundleLoader.CreateLoader <SyncLoader>(); if (loader == null) { loader = new SyncLoader(); } loader.Load(pathname); UnityEngine.Object result = loader.GetABResult().LoadedObject; loader.Dispose(); return(result); } else { LogMgr.LogErrorFormat("{0} is loading ", pathname); } } else if (Mode == ABLoaderMode.ABTang) { #if USE_TANGAB BundlePkgInfo info = ResBundleMgr.mIns.BundleInformation.SeekInfo(pathname); string resultpath = info.EditorPath.Replace("/", "."); manager.Load(resultpath); #endif } return(null); }
public static void SyncLoad(string pathname, Action <bool, AssetBundleResult> callback) { if (Mode == ABLoaderMode.Self) { if (!ResBundleMgr.mIns.Cache.ContainsLoading(pathname)) { SyncLoader loader = BaseBundleLoader.CreateLoader <SyncLoader>(); if (loader == null) { loader = new SyncLoader(); } if (callback != null) { loader.onComplete += callback; } loader.Load(pathname); loader.Dispose(); } else { LogMgr.LogErrorFormat("{0} is loading ", pathname); } } else if (Mode == ABLoaderMode.ABTang) { #if USE_TANGAB BundlePkgInfo info = ResBundleMgr.mIns.BundleInformation.SeekInfo(pathname); string resultpath = info.EditorPath.Replace("/", "."); manager.Load(resultpath, (result) => { if (callback != null) { callback(true, Info2Result(result)); } }); #endif } }