mirror of https://github.com/tuyoogame/YooAsset
Update AssetBundleBuilder
parent
299f770692
commit
a91f1bd020
|
@ -13,17 +13,12 @@ namespace YooAsset.Editor
|
|||
/// <summary>
|
||||
/// 资源路径
|
||||
/// </summary>
|
||||
public string AssetPath { private set; get; }
|
||||
public string AssetPath;
|
||||
|
||||
/// <summary>
|
||||
/// 资源包标签
|
||||
/// 资源包完整名称
|
||||
/// </summary>
|
||||
public string BundleLabel { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源包文件格式
|
||||
/// </summary>
|
||||
public string BundleVariant { private set; get; }
|
||||
public string BundleName;
|
||||
|
||||
/// <summary>
|
||||
/// 是否为原生资源
|
||||
|
@ -46,10 +41,10 @@ namespace YooAsset.Editor
|
|||
public int DependCount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖的所有资源信息
|
||||
/// 注意:包括零依赖资源(零依赖资源的资源包名无效)
|
||||
/// 依赖的所有资源
|
||||
/// 注意:包括零依赖资源和冗余资源(资源包名无效)
|
||||
/// </summary>
|
||||
public List<BuildAssetInfo> AllDependAssetInfos { private set; get; } = null;
|
||||
public List<BuildAssetInfo> AllDependAssetInfos;
|
||||
|
||||
|
||||
public BuildAssetInfo(string assetPath)
|
||||
|
@ -73,11 +68,10 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public void SetBundleLabelAndVariant(string bundleLabel, string bundleVariant)
|
||||
{
|
||||
if (string.IsNullOrEmpty(BundleLabel) == false || string.IsNullOrEmpty(BundleVariant) == false)
|
||||
if (string.IsNullOrEmpty(BundleName) == false)
|
||||
throw new System.Exception("Should never get here !");
|
||||
|
||||
BundleLabel = bundleLabel;
|
||||
BundleVariant = bundleVariant;
|
||||
BundleName = AssetBundleBuilderHelper.MakeBundleName(bundleLabel, bundleVariant);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -95,25 +89,14 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源包的完整名称
|
||||
/// 资源包名是否有效
|
||||
/// </summary>
|
||||
public string GetBundleName()
|
||||
public bool BundleNameIsValid()
|
||||
{
|
||||
if (string.IsNullOrEmpty(BundleLabel) || string.IsNullOrEmpty(BundleVariant))
|
||||
throw new System.ArgumentNullException();
|
||||
|
||||
return AssetBundleBuilderHelper.MakeBundleName(BundleLabel, BundleVariant);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测资源包名是否有效
|
||||
/// </summary>
|
||||
public bool CheckBundleNameValid()
|
||||
{
|
||||
if (string.IsNullOrEmpty(BundleLabel) == false && string.IsNullOrEmpty(BundleVariant) == false)
|
||||
return true;
|
||||
else
|
||||
if (string.IsNullOrEmpty(BundleName))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,22 +15,12 @@ namespace YooAsset.Editor
|
|||
/// <summary>
|
||||
/// 资源包完整名称
|
||||
/// </summary>
|
||||
public string BundleName { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源包标签名
|
||||
/// </summary>
|
||||
public string BundleLabel { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源包文件格式
|
||||
/// </summary>
|
||||
public string BundleVariant { private set; get; }
|
||||
public string BundleName;
|
||||
|
||||
/// <summary>
|
||||
/// 包含的资源列表
|
||||
/// </summary>
|
||||
public readonly List<BuildAssetInfo> Assets = new List<BuildAssetInfo>();
|
||||
public List<BuildAssetInfo> Assets = new List<BuildAssetInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 是否为原生文件
|
||||
|
@ -49,11 +39,9 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
|
||||
public BuildBundleInfo(string bundleLabel, string bundleVariant)
|
||||
public BuildBundleInfo(string bundleName)
|
||||
{
|
||||
BundleLabel = bundleLabel;
|
||||
BundleVariant = bundleVariant;
|
||||
BundleName = AssetBundleBuilderHelper.MakeBundleName(bundleLabel, bundleVariant);
|
||||
BundleName = bundleName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -110,14 +98,6 @@ namespace YooAsset.Editor
|
|||
return result.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取主动收集的资源路径列表
|
||||
/// </summary>
|
||||
public string[] GetCollectAssetPaths()
|
||||
{
|
||||
return Assets.Where(t => t.IsCollectAsset).Select(t => t.AssetPath).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取构建的资源路径列表
|
||||
/// </summary>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 构建报告
|
||||
|
@ -12,6 +10,40 @@ namespace YooAsset
|
|||
[Serializable]
|
||||
public class BuildReport
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源包列表
|
||||
/// </summary>
|
||||
public readonly List<BuildBundleInfo> BundleInfos = new List<BuildBundleInfo>(1000);
|
||||
|
||||
/// <summary>
|
||||
/// 冗余的资源列表
|
||||
/// </summary>
|
||||
public readonly List<string> RedundancyList = new List<string>(1000);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检测是否包含BundleName
|
||||
/// </summary>
|
||||
public bool IsContainsBundle(string bundleFullName)
|
||||
{
|
||||
return TryGetBundleInfo(bundleFullName, out BuildBundleInfo bundleInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 尝试获取资源包类,如果没有返回空
|
||||
/// </summary>
|
||||
public bool TryGetBundleInfo(string bundleFullName, out BuildBundleInfo result)
|
||||
{
|
||||
foreach (var bundleInfo in BundleInfos)
|
||||
{
|
||||
if (bundleInfo.BundleName == bundleFullName)
|
||||
{
|
||||
result = bundleInfo;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
result = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,7 +31,7 @@ namespace YooAsset.Editor
|
|||
context.SetContextObject(unityManifestContext);
|
||||
|
||||
// 拷贝原生文件
|
||||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||
foreach (var bundleInfo in buildMapContext.Report.BundleInfos)
|
||||
{
|
||||
if (bundleInfo.IsRawFile)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ namespace YooAsset.Editor
|
|||
|
||||
// 1. 过滤掉原生Bundle
|
||||
List<BuildBundleInfo> expectBundles = new List<BuildBundleInfo>(buildedBundles.Length);
|
||||
foreach(var bundleInfo in buildMapContext.BundleInfos)
|
||||
foreach(var bundleInfo in buildMapContext.Report.BundleInfos)
|
||||
{
|
||||
if (bundleInfo.IsRawFile == false)
|
||||
expectBundles.Add(bundleInfo);
|
||||
|
@ -77,7 +77,7 @@ namespace YooAsset.Editor
|
|||
// 3. 正向验证Bundle
|
||||
foreach (var bundleName in buildedBundles)
|
||||
{
|
||||
if (buildMapContext.IsContainsBundle(bundleName) == false)
|
||||
if (buildMapContext.Report.IsContainsBundle(bundleName) == false)
|
||||
{
|
||||
throw new Exception($"Should never get here !");
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace YooAsset.Editor
|
|||
patchManifest.ResourceVersion = buildParameters.Parameters.BuildVersion;
|
||||
patchManifest.BuildinTags = buildParameters.Parameters.BuildinTags;
|
||||
patchManifest.BundleList = GetAllPatchBundle(buildParameters, buildMapContext, encryptionContext);
|
||||
patchManifest.AssetList = GetAllPatchAsset(buildMapContext, patchManifest.BundleList);
|
||||
patchManifest.AssetList = GetAllPatchAsset(buildMapContext, patchManifest);
|
||||
|
||||
// 创建补丁清单文件
|
||||
string manifestFilePath = $"{buildParameters.PipelineOutputDirectory}/{ResourceSettingData.Setting.PatchManifestFileName}";
|
||||
|
@ -61,7 +61,7 @@ namespace YooAsset.Editor
|
|||
oldPatchManifest = AssetBundleBuilderHelper.LoadPatchManifestFile(buildParameters.PipelineOutputDirectory);
|
||||
}
|
||||
|
||||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||
foreach (var bundleInfo in buildMapContext.Report.BundleInfos)
|
||||
{
|
||||
var bundleName = bundleInfo.BundleName;
|
||||
string filePath = $"{buildParameters.PipelineOutputDirectory}/{bundleName}";
|
||||
|
@ -111,41 +111,41 @@ namespace YooAsset.Editor
|
|||
/// <summary>
|
||||
/// 获取资源列表
|
||||
/// </summary>
|
||||
private List<PatchAsset> GetAllPatchAsset(TaskGetBuildMap.BuildMapContext buildMapContext, List<PatchBundle> bundleList)
|
||||
private List<PatchAsset> GetAllPatchAsset(TaskGetBuildMap.BuildMapContext buildMapContext, PatchManifest patchManifest)
|
||||
{
|
||||
List<PatchAsset> result = new List<PatchAsset>(1000);
|
||||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||
foreach (var bundleInfo in buildMapContext.Report.BundleInfos)
|
||||
{
|
||||
var assetInfos = bundleInfo.GetCollectAssetInfos();
|
||||
foreach (var assetInfo in assetInfos)
|
||||
{
|
||||
PatchAsset patchAsset = new PatchAsset();
|
||||
patchAsset.AssetPath = assetInfo.AssetPath;
|
||||
patchAsset.BundleID = GetAssetBundleID(assetInfo.GetBundleName(), bundleList);
|
||||
patchAsset.DependIDs = GetAssetBundleDependIDs(assetInfo, bundleList);
|
||||
patchAsset.BundleID = GetAssetBundleID(assetInfo.BundleName, patchManifest);
|
||||
patchAsset.DependIDs = GetAssetBundleDependIDs(assetInfo, patchManifest);
|
||||
result.Add(patchAsset);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private int[] GetAssetBundleDependIDs(BuildAssetInfo assetInfo, List<PatchBundle> bundleList)
|
||||
private int[] GetAssetBundleDependIDs(BuildAssetInfo assetInfo, PatchManifest patchManifest)
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
foreach (var dependAssetInfo in assetInfo.AllDependAssetInfos)
|
||||
{
|
||||
if (dependAssetInfo.CheckBundleNameValid() == false)
|
||||
if (dependAssetInfo.BundleNameIsValid() == false)
|
||||
continue;
|
||||
int bundleID = GetAssetBundleID(dependAssetInfo.GetBundleName(), bundleList);
|
||||
int bundleID = GetAssetBundleID(dependAssetInfo.BundleName, patchManifest);
|
||||
if (result.Contains(bundleID) == false)
|
||||
result.Add(bundleID);
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
private int GetAssetBundleID(string bundleName, List<PatchBundle> bundleList)
|
||||
private int GetAssetBundleID(string bundleName, PatchManifest patchManifest)
|
||||
{
|
||||
for (int index = 0; index < bundleList.Count; index++)
|
||||
for (int index = 0; index < patchManifest.BundleList.Count; index++)
|
||||
{
|
||||
if (bundleList[index].BundleName == bundleName)
|
||||
if (patchManifest.BundleList[index].BundleName == bundleName)
|
||||
return index;
|
||||
}
|
||||
throw new Exception($"Not found bundle name : {bundleName}");
|
||||
|
|
|
@ -77,17 +77,17 @@ namespace YooAsset.Editor
|
|||
|
||||
AppendData(content, "");
|
||||
AppendData(content, $"--冗余列表--");
|
||||
for (int i = 0; i < buildMapContext.RedundancyList.Count; i++)
|
||||
for (int i = 0; i < buildMapContext.Report.RedundancyList.Count; i++)
|
||||
{
|
||||
string redundancyAssetPath = buildMapContext.RedundancyList[i];
|
||||
string redundancyAssetPath = buildMapContext.Report.RedundancyList[i];
|
||||
AppendData(content, redundancyAssetPath);
|
||||
}
|
||||
|
||||
AppendData(content, "");
|
||||
AppendData(content, $"--构建列表--");
|
||||
for (int i = 0; i < buildMapContext.BundleInfos.Count; i++)
|
||||
for (int i = 0; i < buildMapContext.Report.BundleInfos.Count; i++)
|
||||
{
|
||||
string bundleName = buildMapContext.BundleInfos[i].BundleName;
|
||||
string bundleName = buildMapContext.Report.BundleInfos[i].BundleName;
|
||||
AppendData(content, bundleName);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace YooAsset.Editor
|
|||
|
||||
UnityEngine.Debug.Log($"开始加密资源文件");
|
||||
int progressValue = 0;
|
||||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||
foreach (var bundleInfo in buildMapContext.Report.BundleInfos)
|
||||
{
|
||||
var bundleName = bundleInfo.BundleName;
|
||||
string filePath = $"{buildParameters.PipelineOutputDirectory}/{bundleName}";
|
||||
|
@ -83,7 +83,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
// 进度条
|
||||
EditorTools.DisplayProgressBar("加密资源包", ++progressValue, buildMapContext.BundleInfos.Count);
|
||||
EditorTools.DisplayProgressBar("加密资源包", ++progressValue, buildMapContext.Report.BundleInfos.Count);
|
||||
}
|
||||
EditorTools.ClearProgressBar();
|
||||
|
||||
|
|
|
@ -11,31 +11,22 @@ namespace YooAsset.Editor
|
|||
{
|
||||
public class BuildMapContext : IContextObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源包列表
|
||||
/// </summary>
|
||||
public readonly List<BuildBundleInfo> BundleInfos = new List<BuildBundleInfo>(1000);
|
||||
|
||||
/// <summary>
|
||||
/// 冗余的资源列表
|
||||
/// </summary>
|
||||
public readonly List<string> RedundancyList = new List<string>(1000);
|
||||
|
||||
public BuildReport Report = new BuildReport();
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个打包资源
|
||||
/// </summary>
|
||||
public void PackAsset(BuildAssetInfo assetInfo)
|
||||
{
|
||||
if (TryGetBundleInfo(assetInfo.GetBundleName(), out BuildBundleInfo bundleInfo))
|
||||
if (Report.TryGetBundleInfo(assetInfo.BundleName, out BuildBundleInfo bundleInfo))
|
||||
{
|
||||
bundleInfo.PackAsset(assetInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildBundleInfo newBundleInfo = new BuildBundleInfo(assetInfo.BundleLabel, assetInfo.BundleVariant);
|
||||
BuildBundleInfo newBundleInfo = new BuildBundleInfo(assetInfo.BundleName);
|
||||
newBundleInfo.PackAsset(assetInfo);
|
||||
BundleInfos.Add(newBundleInfo);
|
||||
Report.BundleInfos.Add(newBundleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,8 +35,8 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public List<BuildAssetInfo> GetAllAssets()
|
||||
{
|
||||
List<BuildAssetInfo> result = new List<BuildAssetInfo>(BundleInfos.Count);
|
||||
foreach (var bundleInfo in BundleInfos)
|
||||
List<BuildAssetInfo> result = new List<BuildAssetInfo>(Report.BundleInfos.Count);
|
||||
foreach (var bundleInfo in Report.BundleInfos)
|
||||
{
|
||||
result.AddRange(bundleInfo.Assets);
|
||||
}
|
||||
|
@ -57,31 +48,19 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public string[] GetAssetTags(string bundleFullName)
|
||||
{
|
||||
if (TryGetBundleInfo(bundleFullName, out BuildBundleInfo bundleInfo))
|
||||
if (Report.TryGetBundleInfo(bundleFullName, out BuildBundleInfo bundleInfo))
|
||||
{
|
||||
return bundleInfo.GetAssetTags();
|
||||
}
|
||||
throw new Exception($"Not found {nameof(BuildBundleInfo)} : {bundleFullName}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取AssetBundle内收集的资源路径列表
|
||||
/// </summary>
|
||||
public string[] GetCollectAssetPaths(string bundleFullName)
|
||||
{
|
||||
if (TryGetBundleInfo(bundleFullName, out BuildBundleInfo bundleInfo))
|
||||
{
|
||||
return bundleInfo.GetCollectAssetPaths();
|
||||
}
|
||||
throw new Exception($"Not found {nameof(BuildBundleInfo)} : {bundleFullName}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取AssetBundle内构建的资源路径列表
|
||||
/// </summary>
|
||||
public string[] GetBuildinAssetPaths(string bundleFullName)
|
||||
{
|
||||
if (TryGetBundleInfo(bundleFullName, out BuildBundleInfo bundleInfo))
|
||||
if (Report.TryGetBundleInfo(bundleFullName, out BuildBundleInfo bundleInfo))
|
||||
{
|
||||
return bundleInfo.GetBuildinAssetPaths();
|
||||
}
|
||||
|
@ -93,36 +72,14 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public UnityEditor.AssetBundleBuild[] GetPipelineBuilds()
|
||||
{
|
||||
List<AssetBundleBuild> builds = new List<AssetBundleBuild>(BundleInfos.Count);
|
||||
foreach (var bundleInfo in BundleInfos)
|
||||
List<UnityEditor.AssetBundleBuild> builds = new List<UnityEditor.AssetBundleBuild>(Report.BundleInfos.Count);
|
||||
foreach (var bundleInfo in Report.BundleInfos)
|
||||
{
|
||||
if (bundleInfo.IsRawFile == false)
|
||||
builds.Add(bundleInfo.CreatePipelineBuild());
|
||||
}
|
||||
return builds.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测是否包含BundleName
|
||||
/// </summary>
|
||||
public bool IsContainsBundle(string bundleFullName)
|
||||
{
|
||||
return TryGetBundleInfo(bundleFullName, out BuildBundleInfo bundleInfo);
|
||||
}
|
||||
|
||||
private bool TryGetBundleInfo(string bundleFullName, out BuildBundleInfo result)
|
||||
{
|
||||
foreach (var bundleInfo in BundleInfos)
|
||||
{
|
||||
if (bundleInfo.BundleName == bundleFullName)
|
||||
{
|
||||
result = bundleInfo;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
result = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,7 +99,7 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
private void SetupBuildMap(BuildMapContext buildMapContext, AssetBundleBuilder.BuildParametersContext buildParameters)
|
||||
{
|
||||
Dictionary<string, BuildAssetInfo> buildAssets = new Dictionary<string, BuildAssetInfo>();
|
||||
Dictionary<string, BuildAssetInfo> buildAssetDic = new Dictionary<string, BuildAssetInfo>();
|
||||
|
||||
// 1. 获取主动收集的资源
|
||||
List<CollectAssetInfo> allCollectInfos = AssetBundleCollectorSettingData.GetAllCollectAssets();
|
||||
|
@ -160,23 +117,19 @@ namespace YooAsset.Editor
|
|||
string assetPath = depends[i].AssetPath;
|
||||
|
||||
// 如果已经存在,则增加该资源的依赖计数
|
||||
if (buildAssets.ContainsKey(assetPath))
|
||||
{
|
||||
buildAssets[assetPath].DependCount++;
|
||||
}
|
||||
if (buildAssetDic.ContainsKey(assetPath))
|
||||
buildAssetDic[assetPath].DependCount++;
|
||||
else
|
||||
{
|
||||
buildAssets.Add(assetPath, depends[i]);
|
||||
}
|
||||
buildAssetDic.Add(assetPath, depends[i]);
|
||||
|
||||
// 添加资源标记
|
||||
buildAssets[assetPath].AddAssetTags(collectInfo.AssetTags);
|
||||
buildAssetDic[assetPath].AddAssetTags(collectInfo.AssetTags);
|
||||
|
||||
// 注意:检测是否为主动收集资源
|
||||
if (assetPath == mainAssetPath)
|
||||
{
|
||||
buildAssets[mainAssetPath].IsCollectAsset = true;
|
||||
buildAssets[mainAssetPath].IsRawAsset = collectInfo.IsRawAsset;
|
||||
buildAssetDic[mainAssetPath].IsCollectAsset = true;
|
||||
buildAssetDic[mainAssetPath].IsRawAsset = collectInfo.IsRawAsset;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,9 +140,9 @@ namespace YooAsset.Editor
|
|||
{
|
||||
string assetPath = depends[i].AssetPath;
|
||||
if (assetPath != mainAssetPath)
|
||||
allDependAssetInfos.Add(buildAssets[assetPath]);
|
||||
allDependAssetInfos.Add(buildAssetDic[assetPath]);
|
||||
}
|
||||
buildAssets[mainAssetPath].SetAllDependAssetInfos(allDependAssetInfos);
|
||||
buildAssetDic[mainAssetPath].SetAllDependAssetInfos(allDependAssetInfos);
|
||||
|
||||
EditorTools.DisplayProgressBar("依赖文件分析", ++progressValue, allCollectInfos.Count);
|
||||
}
|
||||
|
@ -198,7 +151,7 @@ namespace YooAsset.Editor
|
|||
// 3. 移除零依赖的资源
|
||||
var redundancy = CreateAssetRedundancy();
|
||||
List<BuildAssetInfo> undependentAssets = new List<BuildAssetInfo>();
|
||||
foreach (KeyValuePair<string, BuildAssetInfo> pair in buildAssets)
|
||||
foreach (KeyValuePair<string, BuildAssetInfo> pair in buildAssetDic)
|
||||
{
|
||||
var buildAssetInfo = pair.Value;
|
||||
if (buildAssetInfo.IsCollectAsset)
|
||||
|
@ -216,7 +169,7 @@ namespace YooAsset.Editor
|
|||
if(redundancy.Check(buildAssetInfo.AssetPath))
|
||||
{
|
||||
undependentAssets.Add(buildAssetInfo);
|
||||
buildMapContext.RedundancyList.Add(buildAssetInfo.AssetPath);
|
||||
buildMapContext.Report.RedundancyList.Add(buildAssetInfo.AssetPath);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -227,18 +180,18 @@ namespace YooAsset.Editor
|
|||
if (AssetBundleCollectorSettingData.HasCollector(buildAssetInfo.AssetPath) == false)
|
||||
{
|
||||
undependentAssets.Add(buildAssetInfo);
|
||||
buildMapContext.RedundancyList.Add(buildAssetInfo.AssetPath);
|
||||
buildMapContext.Report.RedundancyList.Add(buildAssetInfo.AssetPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var assetInfo in undependentAssets)
|
||||
{
|
||||
buildAssets.Remove(assetInfo.AssetPath);
|
||||
buildAssetDic.Remove(assetInfo.AssetPath);
|
||||
}
|
||||
|
||||
// 4. 设置资源包名
|
||||
progressValue = 0;
|
||||
foreach (KeyValuePair<string, BuildAssetInfo> pair in buildAssets)
|
||||
foreach (KeyValuePair<string, BuildAssetInfo> pair in buildAssetDic)
|
||||
{
|
||||
var assetInfo = pair.Value;
|
||||
var bundleLabel = AssetBundleCollectorSettingData.GetBundleLabel(assetInfo.AssetPath);
|
||||
|
@ -246,15 +199,14 @@ namespace YooAsset.Editor
|
|||
assetInfo.SetBundleLabelAndVariant(bundleLabel, ResourceSettingData.Setting.RawFileVariant);
|
||||
else
|
||||
assetInfo.SetBundleLabelAndVariant(bundleLabel, ResourceSettingData.Setting.AssetBundleFileVariant);
|
||||
EditorTools.DisplayProgressBar("设置资源包名", ++progressValue, buildAssets.Count);
|
||||
EditorTools.DisplayProgressBar("设置资源包名", ++progressValue, buildAssetDic.Count);
|
||||
}
|
||||
EditorTools.ClearProgressBar();
|
||||
|
||||
// 4. 构建资源包
|
||||
var allAssets = buildAssets.Values.ToList();
|
||||
var allAssets = buildAssetDic.Values.ToList();
|
||||
if (allAssets.Count == 0)
|
||||
throw new Exception("构建的资源列表不能为空");
|
||||
UnityEngine.Debug.Log($"构建的资源列表里总共有{allAssets.Count}个资源");
|
||||
foreach (var assetInfo in allAssets)
|
||||
{
|
||||
buildMapContext.PackAsset(assetInfo);
|
||||
|
@ -285,7 +237,7 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
private void CheckBuildMapContent(BuildMapContext buildMapContext)
|
||||
{
|
||||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||
foreach (var bundleInfo in buildMapContext.Report.BundleInfos)
|
||||
{
|
||||
// 注意:原生文件资源包只能包含一个原生文件
|
||||
bool isRawFile = bundleInfo.IsRawFile;
|
||||
|
|
Loading…
Reference in New Issue