Optimize packaging bundle core logic
优化了打包的核心逻辑,对依赖资源进行自动划分。
This commit is contained in:
@@ -45,41 +45,39 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public List<CollectAssetInfo> GetAllCollectAssets()
|
||||
{
|
||||
Dictionary<string, string> adressTemper = new Dictionary<string, string>(10000);
|
||||
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(10000);
|
||||
|
||||
// 收集打包资源
|
||||
foreach (var grouper in Groupers)
|
||||
{
|
||||
var temper = grouper.GetAllCollectAssets();
|
||||
foreach (var assetInfo in temper)
|
||||
{
|
||||
if (result.ContainsKey(assetInfo.AssetPath) == false)
|
||||
{
|
||||
result.Add(assetInfo.AssetPath, assetInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"The collecting asset file is existed : {assetInfo.AssetPath}");
|
||||
}
|
||||
throw new Exception($"The collecting asset file is existed : {assetInfo.AssetPath} in grouper setting.");
|
||||
}
|
||||
}
|
||||
|
||||
// 检测可寻址地址是否重复
|
||||
if (EnableAddressable)
|
||||
{
|
||||
foreach (var collectInfo in result)
|
||||
HashSet<string> adressTemper = new HashSet<string>();
|
||||
foreach (var collectInfoPair in result)
|
||||
{
|
||||
string address = collectInfo.Value.Address;
|
||||
if (adressTemper.ContainsKey(address) == false)
|
||||
if (collectInfoPair.Value.CollectorType == ECollectorType.MainCollector)
|
||||
{
|
||||
adressTemper.Add(address, address);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"The address is existed : {address}");
|
||||
string address = collectInfoPair.Value.Address;
|
||||
if (adressTemper.Contains(address) == false)
|
||||
adressTemper.Add(address);
|
||||
else
|
||||
throw new Exception($"The address is existed : {address} in grouper setting.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 返回列表
|
||||
return result.Values.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user