private static void CheckExportBundle() { if (hasExported) { foreach (string path in pathList) { string fileName = FileEx.GetFileName(path); string resPath = ResourcesLoaderHelper.GetResourcesBundlePathByObjectName(fileName); if (resPath == null) { isAllFile = false; Debug.logger.LogError("打包工具", "Resources文件缺失!" + path); } if (!File.Exists(resPath)) { isAllFile = false; Debug.logger.LogError("打包工具", "Bundle文件缺失!" + resPath); } resPath = ResourcesLoaderHelper.GetResourcesBundleManifestPathByObjectName(fileName); if (!File.Exists(resPath)) { isAllFile = false; Debug.logger.LogError("打包工具", "Bundle文件缺失!" + resPath); } } } if (!isAllFile) { hasExported = false; GUILayout.Label("发现文件缺失!请重新打包!"); } }
public Object LoadResource(string objectName, System.Action <Object> afterLoadAct = null) { string bundleName = ResourcesLoaderHelper.GetResourcesBundleNameByObjectName(objectName); ABResInfo assetInfo = LoadFromFileOrCache(bundleName); AssetBundle assetBundle = assetInfo.assetbundle; Object obj = null; if (assetBundle != null) { foreach (string depBundleName in assetInfo.dependenciesNames) { LoadFromFileOrCache(depBundleName); } obj = assetBundle.LoadAsset(objectName); } else { Debug.logger.LogError("加载Bundle", "Bundle为空"); } if (afterLoadAct != null) { afterLoadAct(obj); } if (obj == null) { Debug.logger.LogError("加载错误", "加载失败!"); } return(obj); }
public ABResInfo(string bundleName) { url = ResourcesLoaderHelper.GetBundlePathByBundleName(bundleName); getTimeLastTime = DateTime.Now; assetBundleName = bundleName; dependenciesNames = ResourcesLoaderHelper.Instance.manifest.GetAllDependencies(bundleName); string path = ResourcesLoaderHelper.GetBundlePathByBundleName(bundleName); if (File.Exists(path)) { assetbundle = AssetBundle.LoadFromFile(path); } else { Debug.logger.LogError("LocalResInfo", path + "中的文件不存在!"); } }
private static void CompressPackage() { bundlePathList = new List <string>(); string mainBundlePath = PathConfig.AssetRootBundleFilePath; bundlePathList.Add(mainBundlePath); bundlePathList.Add(mainBundlePath + AssetBundleConst.ManifestEx); foreach (string path in pathList) { string fileName = FileEx.GetFileName(path); string resPath = ResourcesLoaderHelper.GetResourcesBundlePathByObjectName(fileName); bundlePathList.Add(resPath); resPath = ResourcesLoaderHelper.GetResourcesBundleManifestPathByObjectName(fileName); bundlePathList.Add(resPath); } foreach (string path in bundlePathList) { Debug.logger.Log("压缩", path + "压缩"); } CompressHelper.CompressFiles(PathConfig.bundleRootPath, bundlePathList.ToArray(), PathConfig.GetPkgExportPath(resVersion)); string MD5 = MD5Utils.BuildFileMd5(PathConfig.GetPkgExportPath(resVersion)); GenVersionInfo(MD5); }
public LocalResourcesLoader(ResourcesLoaderHelper helper) { assetInfoList = new Dictionary <string, LocalResInfo>(); LoadHelper = helper; }
public BundleResourcesLoader(ResourcesLoaderHelper helper) { LoadHelper = helper; assetInfoList = new Dictionary <string, ABResInfo>(); }