update editor code

pull/82/head
hevinci 2023-03-09 15:16:02 +08:00
parent ef8a8ff497
commit 8267904155
18 changed files with 206 additions and 236 deletions

View File

@ -51,7 +51,7 @@ namespace YooAsset.Editor
new TaskCopyRawFile(), //拷贝原生文件
new TaskVerifyBuildResult(), //验证构建结果
new TaskEncryption(), //加密资源文件
new TaskUpdateBuildInfo(), //更新构建信息
new TaskUpdatePatchInfo(), //更新补丁信息
new TaskCreatePatchManifest(), //创建清单文件
new TaskCreateReport(), //创建报告文件
new TaskCreatePatchPackage(), //制作补丁包
@ -68,7 +68,7 @@ namespace YooAsset.Editor
new TaskCopyRawFile(), //拷贝原生文件
new TaskVerifyBuildResult_SBP(), //验证构建结果
new TaskEncryption(), //加密资源文件
new TaskUpdateBuildInfo(), //更新构建信息
new TaskUpdatePatchInfo(), //更新补丁信息
new TaskCreatePatchManifest(), //创建清单文件
new TaskCreateReport(), //创建报告文件
new TaskCreatePatchPackage(), //制作补丁包

View File

@ -32,9 +32,15 @@ namespace YooAsset.Editor
public string ShadersBundleName;
/// <summary>
/// 资源包列表
/// 资源包信息列表
/// </summary>
public readonly List<BuildBundleInfo> BundleInfos = new List<BuildBundleInfo>(10000);
public Dictionary<string, BuildBundleInfo>.ValueCollection Collection
{
get
{
return _bundleInfoDic.Values;
}
}
/// <summary>
@ -54,25 +60,10 @@ namespace YooAsset.Editor
{
BuildBundleInfo newBundleInfo = new BuildBundleInfo(bundleName);
newBundleInfo.PackAsset(assetInfo);
BundleInfos.Add(newBundleInfo);
_bundleInfoDic.Add(bundleName, newBundleInfo);
}
}
/// <summary>
/// 获取构建管线里需要的数据
/// </summary>
public UnityEditor.AssetBundleBuild[] GetPipelineBuilds()
{
List<UnityEditor.AssetBundleBuild> builds = new List<UnityEditor.AssetBundleBuild>(BundleInfos.Count);
foreach (var bundleInfo in BundleInfos)
{
if (bundleInfo.IsRawFile == false)
builds.Add(bundleInfo.CreatePipelineBuild());
}
return builds.ToArray();
}
/// <summary>
/// 是否包含资源包
/// </summary>
@ -93,6 +84,20 @@ namespace YooAsset.Editor
throw new Exception($"Not found bundle : {bundleName}");
}
/// <summary>
/// 获取构建管线里需要的数据
/// </summary>
public UnityEditor.AssetBundleBuild[] GetPipelineBuilds()
{
List<UnityEditor.AssetBundleBuild> builds = new List<UnityEditor.AssetBundleBuild>(_bundleInfoDic.Count);
foreach (var bundleInfo in _bundleInfoDic.Values)
{
if (bundleInfo.IsRawFile == false)
builds.Add(bundleInfo.CreatePipelineBuild());
}
return builds.ToArray();
}
/// <summary>
/// 创建着色器信息类
/// </summary>
@ -101,7 +106,6 @@ namespace YooAsset.Editor
if (IsContainsBundle(shadersBundleName) == false)
{
var shaderBundleInfo = new BuildBundleInfo(shadersBundleName);
BundleInfos.Add(shaderBundleInfo);
_bundleInfoDic.Add(shadersBundleName, shaderBundleInfo);
}
}

View File

@ -1,145 +0,0 @@
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
namespace YooAsset.Editor
{
public static class BuildMapCreater
{
/// <summary>
/// 执行资源构建上下文
/// </summary>
public static BuildMapContext CreateBuildMap(EBuildMode buildMode, string packageName)
{
Dictionary<string, BuildAssetInfo> buildAssetDic = new Dictionary<string, BuildAssetInfo>(1000);
// 1. 检测配置合法性
AssetBundleCollectorSettingData.Setting.CheckConfigError();
// 2. 获取所有收集器收集的资源
var buildResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName);
List<CollectAssetInfo> allCollectAssets = buildResult.CollectAssets;
// 3. 剔除未被引用的依赖项资源
List<CollectAssetInfo> removeDependList = new List<CollectAssetInfo>();
foreach (var collectAssetInfo in allCollectAssets)
{
if (collectAssetInfo.CollectorType == ECollectorType.DependAssetCollector)
{
if (IsRemoveDependAsset(allCollectAssets, collectAssetInfo.AssetPath))
removeDependList.Add(collectAssetInfo);
}
}
foreach (var removeValue in removeDependList)
{
allCollectAssets.Remove(removeValue);
}
// 4. 录入所有收集器收集的资源
foreach (var collectAssetInfo in allCollectAssets)
{
if (buildAssetDic.ContainsKey(collectAssetInfo.AssetPath) == false)
{
var buildAssetInfo = new BuildAssetInfo(
collectAssetInfo.CollectorType, collectAssetInfo.BundleName,
collectAssetInfo.Address, collectAssetInfo.AssetPath, collectAssetInfo.IsRawAsset);
buildAssetInfo.AddAssetTags(collectAssetInfo.AssetTags);
buildAssetInfo.AddBundleTags(collectAssetInfo.AssetTags);
buildAssetDic.Add(collectAssetInfo.AssetPath, buildAssetInfo);
}
else
{
throw new Exception($"Should never get here !");
}
}
// 5. 录入所有收集资源的依赖资源
foreach (var collectAssetInfo in allCollectAssets)
{
string collectAssetBundleName = collectAssetInfo.BundleName;
foreach (var dependAssetPath in collectAssetInfo.DependAssets)
{
if (buildAssetDic.ContainsKey(dependAssetPath))
{
buildAssetDic[dependAssetPath].AddBundleTags(collectAssetInfo.AssetTags);
buildAssetDic[dependAssetPath].AddReferenceBundleName(collectAssetBundleName);
}
else
{
var buildAssetInfo = new BuildAssetInfo(dependAssetPath);
buildAssetInfo.AddBundleTags(collectAssetInfo.AssetTags);
buildAssetInfo.AddReferenceBundleName(collectAssetBundleName);
buildAssetDic.Add(dependAssetPath, buildAssetInfo);
}
}
}
// 6. 填充所有收集资源的依赖列表
foreach (var collectAssetInfo in allCollectAssets)
{
var dependAssetInfos = new List<BuildAssetInfo>(collectAssetInfo.DependAssets.Count);
foreach (var dependAssetPath in collectAssetInfo.DependAssets)
{
if (buildAssetDic.TryGetValue(dependAssetPath, out BuildAssetInfo value))
dependAssetInfos.Add(value);
else
throw new Exception("Should never get here !");
}
buildAssetDic[collectAssetInfo.AssetPath].SetAllDependAssetInfos(dependAssetInfos);
}
// 7. 记录关键信息
BuildMapContext context = new BuildMapContext();
context.AssetFileCount = buildAssetDic.Count;
context.EnableAddressable = buildResult.Command.EnableAddressable;
context.UniqueBundleName = buildResult.Command.UniqueBundleName;
context.ShadersBundleName = buildResult.ShadersBundleName;
// 8. 计算共享的资源包名
var command = buildResult.Command;
foreach (KeyValuePair<string, BuildAssetInfo> pair in buildAssetDic)
{
pair.Value.CalculateShareBundleName(command.UniqueBundleName, command.PackageName, buildResult.ShadersBundleName);
}
// 9. 移除不参与构建的资源
List<BuildAssetInfo> removeBuildList = new List<BuildAssetInfo>();
foreach (KeyValuePair<string, BuildAssetInfo> pair in buildAssetDic)
{
var buildAssetInfo = pair.Value;
if (buildAssetInfo.HasBundleName() == false)
removeBuildList.Add(buildAssetInfo);
}
foreach (var removeValue in removeBuildList)
{
buildAssetDic.Remove(removeValue.AssetPath);
}
// 10. 构建资源包
var allBuildinAssets = buildAssetDic.Values.ToList();
if (allBuildinAssets.Count == 0)
throw new Exception("构建的资源列表不能为空");
foreach (var assetInfo in allBuildinAssets)
{
context.PackAsset(assetInfo);
}
return context;
}
private static bool IsRemoveDependAsset(List<CollectAssetInfo> allCollectAssets, string dependAssetPath)
{
foreach (var collectAssetInfo in allCollectAssets)
{
var collectorType = collectAssetInfo.CollectorType;
if (collectorType == ECollectorType.MainAssetCollector || collectorType == ECollectorType.StaticAssetCollector)
{
if (collectAssetInfo.DependAssets.Contains(dependAssetPath))
return false;
}
}
BuildLogger.Log($"发现未被依赖的资源并自动移除 : {dependAssetPath}");
return true;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e9274735f1f14af4b893c21a4240b816
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -27,7 +27,7 @@ namespace YooAsset.Editor
private void CopyRawBundle(BuildMapContext buildMapContext, BuildParametersContext buildParametersContext)
{
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
if (bundleInfo.IsRawFile)
{

View File

@ -119,7 +119,7 @@ namespace YooAsset.Editor
var buildMapContext = context.GetContextObject<BuildMapContext>();
List<PatchBundle> result = new List<PatchBundle>(1000);
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
var patchBundle = bundleInfo.CreatePatchBundle();
result.Add(patchBundle);
@ -135,7 +135,7 @@ namespace YooAsset.Editor
var buildMapContext = context.GetContextObject<BuildMapContext>();
List<PatchAsset> result = new List<PatchAsset>(1000);
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
var assetInfos = bundleInfo.GetAllPatchAssetInfos();
foreach (var assetInfo in assetInfos)

View File

@ -67,8 +67,8 @@ namespace YooAsset.Editor
// 拷贝所有补丁文件
int progressValue = 0;
int patchFileTotalCount = buildMapContext.BundleInfos.Count;
foreach (var bundleInfo in buildMapContext.BundleInfos)
int patchFileTotalCount = buildMapContext.Collection.Count;
foreach (var bundleInfo in buildMapContext.Collection)
{
EditorTools.CopyFile(bundleInfo.PatchInfo.BuildOutputFilePath, bundleInfo.PatchInfo.PatchOutputFilePath, true);
EditorTools.DisplayProgressBar("拷贝补丁文件", ++progressValue, patchFileTotalCount);

View File

@ -35,7 +35,7 @@ namespace YooAsset.Editor
int progressValue = 0;
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
EncryptFileInfo fileInfo = new EncryptFileInfo();
fileInfo.BundleName = bundleInfo.BundleName;
@ -59,7 +59,7 @@ namespace YooAsset.Editor
}
// 进度条
EditorTools.DisplayProgressBar("加密资源包", ++progressValue, buildMapContext.BundleInfos.Count);
EditorTools.DisplayProgressBar("加密资源包", ++progressValue, buildMapContext.Collection.Count);
}
EditorTools.ClearProgressBar();
}

View File

@ -13,7 +13,7 @@ namespace YooAsset.Editor
void IBuildTask.Run(BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
var buildMapContext = BuildMapCreater.CreateBuildMap(buildParametersContext.Parameters.BuildMode, buildParametersContext.Parameters.PackageName);
var buildMapContext = CreateBuildMap(buildParametersContext.Parameters.BuildMode, buildParametersContext.Parameters.PackageName);
context.SetContextObject(buildMapContext);
BuildLogger.Log("构建内容准备完毕!");
@ -21,12 +21,147 @@ namespace YooAsset.Editor
CheckBuildMapContent(buildMapContext);
}
/// <summary>
/// 资源构建上下文
/// </summary>
public BuildMapContext CreateBuildMap(EBuildMode buildMode, string packageName)
{
Dictionary<string, BuildAssetInfo> buildAssetInfoDic = new Dictionary<string, BuildAssetInfo>(1000);
// 1. 检测配置合法性
AssetBundleCollectorSettingData.Setting.CheckConfigError();
// 2. 获取所有收集器收集的资源
var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName);
List<CollectAssetInfo> collectAssetInfos = collectResult.CollectAssets;
// 3. 剔除未被引用的依赖项资源
List<CollectAssetInfo> removeDependList = new List<CollectAssetInfo>();
foreach (var collectAssetInfo in collectAssetInfos)
{
if (collectAssetInfo.CollectorType == ECollectorType.DependAssetCollector)
{
if (IsRemoveDependAsset(collectAssetInfos, collectAssetInfo.AssetPath))
removeDependList.Add(collectAssetInfo);
}
}
foreach (var removeValue in removeDependList)
{
collectAssetInfos.Remove(removeValue);
}
// 4. 录入所有收集器收集的资源
foreach (var collectAssetInfo in collectAssetInfos)
{
if (buildAssetInfoDic.ContainsKey(collectAssetInfo.AssetPath) == false)
{
var buildAssetInfo = new BuildAssetInfo(
collectAssetInfo.CollectorType, collectAssetInfo.BundleName,
collectAssetInfo.Address, collectAssetInfo.AssetPath, collectAssetInfo.IsRawAsset);
buildAssetInfo.AddAssetTags(collectAssetInfo.AssetTags);
buildAssetInfo.AddBundleTags(collectAssetInfo.AssetTags);
buildAssetInfoDic.Add(collectAssetInfo.AssetPath, buildAssetInfo);
}
else
{
throw new Exception($"Should never get here !");
}
}
// 5. 录入所有收集资源的依赖资源
foreach (var collectAssetInfo in collectAssetInfos)
{
string collectAssetBundleName = collectAssetInfo.BundleName;
foreach (var dependAssetPath in collectAssetInfo.DependAssets)
{
if (buildAssetInfoDic.ContainsKey(dependAssetPath))
{
buildAssetInfoDic[dependAssetPath].AddBundleTags(collectAssetInfo.AssetTags);
buildAssetInfoDic[dependAssetPath].AddReferenceBundleName(collectAssetBundleName);
}
else
{
var buildAssetInfo = new BuildAssetInfo(dependAssetPath);
buildAssetInfo.AddBundleTags(collectAssetInfo.AssetTags);
buildAssetInfo.AddReferenceBundleName(collectAssetBundleName);
buildAssetInfoDic.Add(dependAssetPath, buildAssetInfo);
}
}
}
// 6. 填充所有收集资源的依赖列表
foreach (var collectAssetInfo in collectAssetInfos)
{
var dependAssetInfos = new List<BuildAssetInfo>(collectAssetInfo.DependAssets.Count);
foreach (var dependAssetPath in collectAssetInfo.DependAssets)
{
if (buildAssetInfoDic.TryGetValue(dependAssetPath, out BuildAssetInfo value))
dependAssetInfos.Add(value);
else
throw new Exception("Should never get here !");
}
buildAssetInfoDic[collectAssetInfo.AssetPath].SetAllDependAssetInfos(dependAssetInfos);
}
// 7. 记录关键信息
BuildMapContext context = new BuildMapContext();
context.AssetFileCount = buildAssetInfoDic.Count;
context.EnableAddressable = collectResult.Command.EnableAddressable;
context.UniqueBundleName = collectResult.Command.UniqueBundleName;
context.ShadersBundleName = collectResult.Command.ShadersBundleName;
// 8. 计算共享的资源包名
var command = collectResult.Command;
foreach (KeyValuePair<string, BuildAssetInfo> pair in buildAssetInfoDic)
{
pair.Value.CalculateShareBundleName(command.UniqueBundleName, command.PackageName, command.ShadersBundleName);
}
// 9. 移除不参与构建的资源
List<BuildAssetInfo> removeBuildList = new List<BuildAssetInfo>();
foreach (KeyValuePair<string, BuildAssetInfo> pair in buildAssetInfoDic)
{
var buildAssetInfo = pair.Value;
if (buildAssetInfo.HasBundleName() == false)
removeBuildList.Add(buildAssetInfo);
}
foreach (var removeValue in removeBuildList)
{
buildAssetInfoDic.Remove(removeValue.AssetPath);
}
// 10. 构建资源包
var allBuildinAssets = buildAssetInfoDic.Values.ToList();
if (allBuildinAssets.Count == 0)
throw new Exception("构建的资源列表不能为空");
foreach (var assetInfo in allBuildinAssets)
{
context.PackAsset(assetInfo);
}
return context;
}
private bool IsRemoveDependAsset(List<CollectAssetInfo> allCollectAssets, string dependAssetPath)
{
foreach (var collectAssetInfo in allCollectAssets)
{
var collectorType = collectAssetInfo.CollectorType;
if (collectorType == ECollectorType.MainAssetCollector || collectorType == ECollectorType.StaticAssetCollector)
{
if (collectAssetInfo.DependAssets.Contains(dependAssetPath))
return false;
}
}
BuildLogger.Log($"发现未被依赖的资源并自动移除 : {dependAssetPath}");
return true;
}
/// <summary>
/// 检测构建结果
/// </summary>
private void CheckBuildMapContent(BuildMapContext buildMapContext)
{
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
// 注意:原生文件资源包只能包含一个原生文件
bool isRawFile = bundleInfo.IsRawFile;

View File

@ -6,8 +6,8 @@ using UnityEditor;
namespace YooAsset.Editor
{
[TaskAttribute("更新构建信息")]
public class TaskUpdateBuildInfo : IBuildTask
[TaskAttribute("更新补丁信息")]
public class TaskUpdatePatchInfo : IBuildTask
{
void IBuildTask.Run(BuildContext context)
{
@ -18,7 +18,7 @@ namespace YooAsset.Editor
int outputNameStyle = (int)buildParametersContext.Parameters.OutputNameStyle;
// 1.检测路径长度
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
// NOTE检测路径长度不要超过260字符。
string filePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
@ -27,7 +27,7 @@ namespace YooAsset.Editor
}
// 2.更新构建输出的文件路径
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
if (bundleInfo.IsEncryptedFile)
bundleInfo.PatchInfo.BuildOutputFilePath = bundleInfo.EncryptedFilePath;
@ -36,7 +36,7 @@ namespace YooAsset.Editor
}
// 3.更新文件其它信息
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
string buildOutputFilePath = bundleInfo.PatchInfo.BuildOutputFilePath;
bundleInfo.PatchInfo.ContentHash = GetBundleContentHash(bundleInfo, context);
@ -46,7 +46,7 @@ namespace YooAsset.Editor
}
// 4.更新补丁包输出的文件路径
foreach (var bundleInfo in buildMapContext.BundleInfos)
foreach (var bundleInfo in buildMapContext.Collection)
{
string patchFileExtension = PatchManifestTools.GetRemoteBundleFileExtension(bundleInfo.BundleName);
string patchFileName = PatchManifestTools.GetRemoteBundleFileName(outputNameStyle, bundleInfo.BundleName, patchFileExtension, bundleInfo.PatchInfo.PatchFileHash);

View File

@ -37,7 +37,7 @@ namespace YooAsset.Editor
string[] unityCreateBundles = unityManifest.GetAllAssetBundles();
// 1. 过滤掉原生Bundle
string[] mapBundles = buildMapContext.BundleInfos.Where(t => t.IsRawFile == false).Select(t => t.BundleName).ToArray();
string[] mapBundles = buildMapContext.Collection.Where(t => t.IsRawFile == false).Select(t => t.BundleName).ToArray();
// 2. 验证Bundle
List<string> exceptBundleList1 = unityCreateBundles.Except(mapBundles).ToList();

View File

@ -38,7 +38,7 @@ namespace YooAsset.Editor
List<string> unityCreateBundles = buildResults.BundleInfos.Keys.ToList();
// 1. 过滤掉原生Bundle
List<string> expectBundles = buildMapContext.BundleInfos.Where(t => t.IsRawFile == false).Select(t => t.BundleName).ToList();
List<string> expectBundles = buildMapContext.Collection.Where(t => t.IsRawFile == false).Select(t => t.BundleName).ToList();
// 2. 验证Bundle
List<string> exceptBundleList1 = unityCreateBundles.Except(expectBundles).ToList();

View File

@ -217,7 +217,7 @@ namespace YooAsset.Editor
private CollectAssetInfo CreateCollectAssetInfo(CollectCommand command, AssetBundleCollectorGroup group, string assetPath, bool isRawFilePackRule)
{
string address = GetAddress(group, assetPath);
string address = GetAddress(command, group, assetPath);
string bundleName = GetBundleName(command, group, assetPath);
List<string> assetTags = GetAssetTags(group);
CollectAssetInfo collectAssetInfo = new CollectAssetInfo(CollectorType, bundleName, address, assetPath, isRawFilePackRule, assetTags);
@ -280,20 +280,11 @@ namespace YooAsset.Editor
}
string fileExtension = System.IO.Path.GetExtension(assetPath);
if (IsIgnoreFile(fileExtension))
if (DefaultFilterRule.IsIgnoreFile(fileExtension))
return false;
return true;
}
private bool IsIgnoreFile(string fileExtension)
{
foreach (var extension in DefaultFilterRule.IgnoreFileExtensions)
{
if (extension == fileExtension)
return true;
}
return false;
}
private bool IsCollectAsset(string assetPath)
{
Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath);
@ -304,8 +295,11 @@ namespace YooAsset.Editor
IFilterRule filterRuleInstance = AssetBundleCollectorSettingData.GetFilterRuleInstance(FilterRuleName);
return filterRuleInstance.IsCollectAsset(new FilterRuleData(assetPath));
}
private string GetAddress(AssetBundleCollectorGroup group, string assetPath)
private string GetAddress(CollectCommand command, AssetBundleCollectorGroup group, string assetPath)
{
if (command.EnableAddressable == false)
return string.Empty;
if (CollectorType != ECollectorType.MainAssetCollector)
return string.Empty;

View File

@ -100,7 +100,7 @@ namespace YooAsset.Editor
{
if (package.PackageName == packageName)
{
CollectCommand command = new CollectCommand(buildMode, package.PackageName, EnableAddressable, UniqueBundleName);
CollectCommand command = new CollectCommand(buildMode, packageName, EnableAddressable, UniqueBundleName);
CollectResult collectResult = new CollectResult(command);
collectResult.SetCollectAssets(package.GetAllCollectAssets(command));
return collectResult;
@ -109,21 +109,5 @@ namespace YooAsset.Editor
throw new Exception($"Not found collector pacakge : {packageName}");
}
/// <summary>
/// 获取所有包裹收集的资源文件
/// </summary>
public List<CollectResult> GetAllPackageAssets(EBuildMode buildMode)
{
List<CollectResult> collectResultList = new List<CollectResult>(1000);
foreach (var package in Packages)
{
CollectCommand command = new CollectCommand(buildMode, package.PackageName, EnableAddressable, UniqueBundleName);
CollectResult collectResult = new CollectResult(command);
collectResult.SetCollectAssets(package.GetAllCollectAssets(command));
collectResultList.Add(collectResult);
}
return collectResultList;
}
}
}

View File

@ -23,12 +23,22 @@ namespace YooAsset.Editor
/// </summary>
public bool UniqueBundleName { private set; get; }
/// <summary>
/// 着色器统一全名称
/// </summary>
public string ShadersBundleName { private set; get; }
public CollectCommand(EBuildMode buildMode, string packageName, bool enableAddressable, bool uniqueBundleName)
{
BuildMode = buildMode;
PackageName = packageName;
EnableAddressable = enableAddressable;
UniqueBundleName = uniqueBundleName;
// 着色器统一全名称
var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
ShadersBundleName = packRuleResult.GetMainBundleName(packageName, uniqueBundleName);
}
}
}

View File

@ -10,26 +10,15 @@ namespace YooAsset.Editor
/// </summary>
public CollectCommand Command { private set; get; }
/// <summary>
/// 着色器统一全名称
/// </summary>
public string ShadersBundleName { private set; get; }
/// <summary>
/// 收集的资源信息列表
/// </summary>
public List<CollectAssetInfo> CollectAssets { private set; get; }
public CollectResult(CollectCommand command)
{
Command = command;
// 着色器统一全名称
var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
ShadersBundleName = packRuleResult.GetMainBundleName(command.PackageName, command.UniqueBundleName);
}
public void SetCollectAssets(List<CollectAssetInfo> collectAssets)
{
CollectAssets = collectAssets;

View File

@ -1,6 +1,8 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEditor;
namespace YooAsset.Editor
{
@ -9,7 +11,15 @@ namespace YooAsset.Editor
/// <summary>
/// 忽略的文件类型
/// </summary>
public static readonly string[] IgnoreFileExtensions = { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
private readonly static HashSet<string> _ignoreFileExtensions = new HashSet<string>() { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
/// <summary>
/// 查询是否为忽略文件
/// </summary>
public static bool IsIgnoreFile(string fileExtension)
{
return _ignoreFileExtensions.Contains(fileExtension);
}
}
[DisplayName("收集所有资源")]