public static void BuildDLCConfig(DLCItem dlc) { //清除缓存 PackedAssets_Internal.Clear(); PackedAssets_Native.Clear(); PackedAssets_DLC.Clear(); Builds.Clear(); Rules.Clear(); AllDependencies.Clear(); AllAssets.Clear(); AllBundles.Clear(); AllSharedBundles.Clear(); Consts.Clear(); //永远提前打包Internal if (!dlc.IsInternal) { BuildDLCConfigInternal(Internal); } //如果不是NativeDLC则先BuildNativeDLC,防止资源被其他DLC重复打包 if (!dlc.IsInternal && !dlc.IsNative) { BuildDLCConfigInternal(Native); } BuildDLCConfigInternal(dlc); }
/// <summary> /// 活的构建的数据 /// </summary> /// <param name="manifestPath"></param> /// <returns></returns> private static List <AssetBundleBuild> GenerateAssetBundleBuildData(DLCItem dlc) { if (dlc.IsInternal) { PackedAssets_Internal.Clear(); } else if (dlc.IsNative) { PackedAssets_Native.Clear(); } PackedAssets_DLC.Clear(); Builds.Clear(); Rules.Clear(); AllDependencies.Clear(); AllAssets.Clear(); AllBundles.Clear(); AllSharedBundles.Clear(); //建立其他文件 List <BuildRuleConfig> tempBuildDatas = dlc.BuildRuleData; if (tempBuildDatas == null && tempBuildDatas.Count == 0) { CLog.Error("没有配置相关的AssetBundle信息"); return(null); } foreach (var item in tempBuildDatas) { BuildRule buildRule = null; if (item.BuildRuleType == BuildRuleType.Directroy) { buildRule = new BuildAssetsWithDirectroy(dlc, item); } else if (item.BuildRuleType == BuildRuleType.FullPath) { buildRule = new BuildAssetsWithPath(dlc, item); } else if (item.BuildRuleType == BuildRuleType.File) { buildRule = new BuildAssetsWithFile(dlc, item); } Rules.Add(buildRule); } //搜集依赖的资源 foreach (var item in Rules) { CollectDependencies(item.Config.FullSearchPath); } //打包共享的资源 BuildSharedAssets(dlc); foreach (var item in Rules) { item.Build(); } EditorUtility.ClearProgressBar(); return(Builds); }