public ResLoadOpertion LoadAssetAsync <T>(string resPath) where T : Object { ResToAssetBundleCnf abInfo = _mainInfo.GetResToAb(resPath); if (abInfo == null) { return(null); } AssetBundleDepCnf abDep = _mainInfo.GetDepsInfo(abInfo.PackagePath); if (abDep == null) { return(null); } foreach (var depInfo in abDep._childRef) { InternalAsyncLoadPackage(depInfo.Key); } ResLoadOpertion resLoadOperation = InternalAsyncLoadPackage(abDep.AbName); return(resLoadOperation); }
public I_ObjectInfo LoadAsset <T>(string resPath) where T : Object { ResToAssetBundleCnf mainPackageCnf = _mainInfo.GetResToAb(resPath); if (mainPackageCnf == null) { return(null); } string mainPackagePath = mainPackageCnf.PackagePath; AssetBundleDepCnf depsCnf = _mainInfo.GetDepsInfo(mainPackagePath); if (depsCnf == null) { return(null); } foreach (var depInfo in depsCnf._childRef) { InternalSyncloadPackage(depInfo.Key); } AssetBundleInfo packageInfo = InternalSyncloadPackage(depsCnf.AbName); ResLog.Assert(packageInfo != null, "AssetBundleLoader LoadAsset 加载主包失败:[{0}]", resPath); return(packageInfo); }
public AssetBundlePackageCnf GetPackageCnfByResPath(string resPath) { ResToAssetBundleCnf resInfo = GetResToAb(resPath); if (resInfo == null) { return(null); } return(GetPackageCnf(resInfo.PackagePath)); }
public string GetResPath(string resPath) { ResToAssetBundleCnf abInfo = _mainInfo.GetResToAb(resPath); if (abInfo == null) { return(string.Empty); } return(abInfo.PackagePath); }
public void InitInfo() { _depMap.Clear(); _packageMap.Clear(); _resMap.Clear(); List <string[]> depResult = GetAbInfo(AssetBundleConst.AssetbundleDepPath); int length = depResult.Count; for (int i = 0; i < length; i++) { AssetBundleDepCnf dep = new AssetBundleDepCnf(); dep.InitInfo(depResult[i]); _depMap.Add(dep.AbName, dep); } InitReverseDep(); List <string[]> packageResult = GetAbInfo(AssetBundleConst.AssetbundlePackagePath); length = packageResult.Count; for (int i = 0; i < length; i++) { AssetBundlePackageCnf packageInfo = new AssetBundlePackageCnf(packageResult[i]); _packageMap.Add(packageInfo.PackagePath, packageInfo); } List <string[]> resResult = GetAbInfo(AssetBundleConst.AssetbundleResPath); length = resResult.Count; for (int i = 0; i < length; i++) { ResToAssetBundleCnf res = new ResToAssetBundleCnf(resResult[i]); _resMap.Add(res.ResPath, res); } }
public T GetAsset <T>(string resPath) where T : Object { ResLog.Assert(!(_assetbundle == null || string.IsNullOrEmpty(resPath)), "AssetBundleInfo GetAsset 失败。PackagePath:[{2}],AssetBundel:[{0}](true代表空),名字:[{1}]", _assetbundle == null, resPath, Path); if (_assetbundle == null || string.IsNullOrEmpty(resPath)) { return(null); } ResToAssetBundleCnf resToAbCnf = AssetBundleManifestInfo.Instance.GetResToAb(resPath); if (resToAbCnf == null) { return(null); } int length = _abList.Count; for (int i = 0; i < length; i++) { ObjectInfo tmpInfo = _abList[i]; if (tmpInfo.Path != resToAbCnf.ResPath) { continue; } if (!tmpInfo.CheckType <T>()) { continue; } RefCount++; return(tmpInfo.GetAsset <T>(String.Empty)); } ResLog.Assert(false, "从资源主包[{0}]中找不到对应类型的AssetInfo:[{1}]的资源", _cnf.PackagePath, resToAbCnf.ResPath); return(null); }