mirror of https://github.com/tuyoogame/YooAsset
Compare commits
No commits in common. "a5f94198c0ec604cc7e2af7e14abfa37140b7419" and "1638bb301d1bdae1fb49d6ca162d0008afa75db9" have entirely different histories.
a5f94198c0
...
1638bb301d
|
@ -18,6 +18,18 @@ namespace YooAsset.Editor
|
||||||
EditorPrefs.SetInt(key, (int)buildPipeline);
|
EditorPrefs.SetInt(key, (int)buildPipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EBuildMode
|
||||||
|
public static EBuildMode GetPackageBuildMode(string packageName, EBuildPipeline buildPipeline)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildMode)}";
|
||||||
|
return (EBuildMode)EditorPrefs.GetInt(key, (int)EBuildMode.ForceRebuild);
|
||||||
|
}
|
||||||
|
public static void SetPackageBuildMode(string packageName, EBuildPipeline buildPipeline, EBuildMode buildMode)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildMode)}";
|
||||||
|
EditorPrefs.SetInt(key, (int)buildMode);
|
||||||
|
}
|
||||||
|
|
||||||
// ECompressOption
|
// ECompressOption
|
||||||
public static ECompressOption GetPackageCompressOption(string packageName, EBuildPipeline buildPipeline)
|
public static ECompressOption GetPackageCompressOption(string packageName, EBuildPipeline buildPipeline)
|
||||||
{
|
{
|
||||||
|
@ -77,17 +89,5 @@ namespace YooAsset.Editor
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
|
||||||
EditorPrefs.SetString(key, encyptionClassName);
|
EditorPrefs.SetString(key, encyptionClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuildCache
|
|
||||||
public static bool GetPackageClearBuildCache(string packageName, EBuildPipeline buildPipeline)
|
|
||||||
{
|
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ClearBuildCache";
|
|
||||||
return EditorPrefs.GetInt(key, 0) > 0;
|
|
||||||
}
|
|
||||||
public static void SetPackageClearBuildCache(string packageName, EBuildPipeline buildPipeline, bool clearBuildCache)
|
|
||||||
{
|
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ClearBuildCache";
|
|
||||||
EditorPrefs.SetInt(key, clearBuildCache ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,14 +8,14 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模拟构建
|
/// 模拟构建
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
|
public static SimulateBuildResult SimulateBuild(string buildPipelineName, string packageName)
|
||||||
{
|
{
|
||||||
string packageName = buildParam.PackageName;
|
|
||||||
var buildParameters = new EditorSimulateBuildParameters();
|
var buildParameters = new EditorSimulateBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = EBuildPipeline.EditorSimulateBuildPipeline.ToString();
|
buildParameters.BuildPipeline = EBuildPipeline.EditorSimulateBuildPipeline.ToString();
|
||||||
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
||||||
|
buildParameters.BuildMode = EBuildMode.ForceRebuild;
|
||||||
buildParameters.PackageName = packageName;
|
buildParameters.PackageName = packageName;
|
||||||
buildParameters.PackageVersion = "Simulate";
|
buildParameters.PackageVersion = "Simulate";
|
||||||
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
||||||
|
@ -26,7 +26,7 @@ namespace YooAsset.Editor
|
||||||
BuildResult buildResult = pipeline.Run(buildParameters, false);
|
BuildResult buildResult = pipeline.Run(buildParameters, false);
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
{
|
{
|
||||||
var reulst = new EditorSimulateBuildResult();
|
SimulateBuildResult reulst = new SimulateBuildResult();
|
||||||
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
|
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
|
||||||
return reulst;
|
return reulst;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildTarget BuildTarget;
|
public BuildTarget BuildTarget;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构建模式
|
||||||
|
/// </summary>
|
||||||
|
public EBuildMode BuildMode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建的包裹名称
|
/// 构建的包裹名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -47,12 +52,7 @@ namespace YooAsset.Editor
|
||||||
public string PackageNote;
|
public string PackageNote;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清空构建缓存文件
|
/// 是否启用共享资源打包
|
||||||
/// </summary>
|
|
||||||
public bool ClearBuildCacheFiles = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 启用共享资源打包
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnableSharePackRule = false;
|
public bool EnableSharePackRule = false;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace YooAsset.Editor
|
||||||
buildReport.Summary.BuildSeconds = BuildRunner.TotalSeconds;
|
buildReport.Summary.BuildSeconds = BuildRunner.TotalSeconds;
|
||||||
buildReport.Summary.BuildTarget = buildParameters.BuildTarget;
|
buildReport.Summary.BuildTarget = buildParameters.BuildTarget;
|
||||||
buildReport.Summary.BuildPipeline = buildParameters.BuildPipeline;
|
buildReport.Summary.BuildPipeline = buildParameters.BuildPipeline;
|
||||||
|
buildReport.Summary.BuildMode = buildParameters.BuildMode;
|
||||||
buildReport.Summary.BuildPackageName = buildParameters.PackageName;
|
buildReport.Summary.BuildPackageName = buildParameters.PackageName;
|
||||||
buildReport.Summary.BuildPackageVersion = buildParameters.PackageVersion;
|
buildReport.Summary.BuildPackageVersion = buildParameters.PackageVersion;
|
||||||
buildReport.Summary.BuildPackageNote = buildParameters.PackageNote;
|
buildReport.Summary.BuildPackageNote = buildParameters.PackageNote;
|
||||||
|
@ -41,7 +42,6 @@ namespace YooAsset.Editor
|
||||||
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
buildReport.Summary.ClearBuildCacheFiles = buildParameters.ClearBuildCacheFiles;
|
|
||||||
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
||||||
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
||||||
if (buildParameters.BuildPipeline == nameof(BuiltinBuildPipeline))
|
if (buildParameters.BuildPipeline == nameof(BuiltinBuildPipeline))
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace YooAsset.Editor
|
||||||
public BuildMapContext CreateBuildMap(bool simulateBuild, BuildParameters buildParameters)
|
public BuildMapContext CreateBuildMap(bool simulateBuild, BuildParameters buildParameters)
|
||||||
{
|
{
|
||||||
BuildMapContext context = new BuildMapContext();
|
BuildMapContext context = new BuildMapContext();
|
||||||
|
var buildMode = buildParameters.BuildMode;
|
||||||
var packageName = buildParameters.PackageName;
|
var packageName = buildParameters.PackageName;
|
||||||
|
|
||||||
Dictionary<string, BuildAssetInfo> allBuildAssetInfos = new Dictionary<string, BuildAssetInfo>(1000);
|
Dictionary<string, BuildAssetInfo> allBuildAssetInfos = new Dictionary<string, BuildAssetInfo>(1000);
|
||||||
|
|
|
@ -12,10 +12,15 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
|
var buildMode = buildParametersContext.Parameters.BuildMode;
|
||||||
|
|
||||||
|
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
||||||
|
{
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
||||||
{
|
{
|
||||||
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,12 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
|
||||||
|
var buildMode = buildParameters.Parameters.BuildMode;
|
||||||
|
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
||||||
|
{
|
||||||
EncryptingBundleFiles(buildParameters, buildMapContext);
|
EncryptingBundleFiles(buildParameters, buildMapContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -24,8 +24,8 @@ namespace YooAsset.Editor
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除包裹目录
|
// 强制构建删除包裹目录
|
||||||
if (buildParameters.ClearBuildCacheFiles)
|
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
|
||||||
{
|
{
|
||||||
string packageRootDirectory = buildParameters.GetPackageRootDirectory();
|
string packageRootDirectory = buildParameters.GetPackageRootDirectory();
|
||||||
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace YooAsset.Editor
|
||||||
else if (CompressOption == ECompressOption.LZ4)
|
else if (CompressOption == ECompressOption.LZ4)
|
||||||
opt |= BuildAssetBundleOptions.ChunkBasedCompression;
|
opt |= BuildAssetBundleOptions.ChunkBasedCompression;
|
||||||
|
|
||||||
if (ClearBuildCacheFiles)
|
if (BuildMode == EBuildMode.ForceRebuild)
|
||||||
opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
|
opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
|
||||||
if (DisableWriteTypeTree)
|
if (DisableWriteTypeTree)
|
||||||
opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
|
opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
|
||||||
|
|
|
@ -10,9 +10,15 @@ namespace YooAsset.Editor
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
|
||||||
|
var buildMode = buildParameters.Parameters.BuildMode;
|
||||||
|
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
||||||
|
{
|
||||||
CopyRawBundle(buildMapContext, buildParametersContext);
|
CopyRawBundle(buildMapContext, buildParametersContext);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拷贝原生文件
|
/// 拷贝原生文件
|
||||||
|
|
|
@ -7,7 +7,12 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
|
||||||
|
var buildMode = buildParameters.Parameters.BuildMode;
|
||||||
|
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
||||||
|
{
|
||||||
EncryptingBundleFiles(buildParameters, buildMapContext);
|
EncryptingBundleFiles(buildParameters, buildMapContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -16,8 +16,15 @@ namespace YooAsset.Editor
|
||||||
// 检测基础构建参数
|
// 检测基础构建参数
|
||||||
buildParametersContext.CheckBuildParameters();
|
buildParametersContext.CheckBuildParameters();
|
||||||
|
|
||||||
// 删除包裹目录
|
// 检测不被支持的构建模式
|
||||||
if (buildParameters.ClearBuildCacheFiles)
|
if (buildParameters.BuildMode == EBuildMode.IncrementalBuild)
|
||||||
|
{
|
||||||
|
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.RawFileBuildPipeline)} not support {nameof(EBuildMode.IncrementalBuild)} build mode !");
|
||||||
|
throw new Exception(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 强制构建删除包裹目录
|
||||||
|
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
|
||||||
{
|
{
|
||||||
string packageRootDirectory = buildParameters.GetPackageRootDirectory();
|
string packageRootDirectory = buildParameters.GetPackageRootDirectory();
|
||||||
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
||||||
|
|
|
@ -12,10 +12,15 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
|
var buildMode = buildParametersContext.Parameters.BuildMode;
|
||||||
|
|
||||||
|
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
||||||
|
{
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
||||||
{
|
{
|
||||||
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,12 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
|
||||||
|
var buildMode = buildParameters.Parameters.BuildMode;
|
||||||
|
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
||||||
|
{
|
||||||
EncryptingBundleFiles(buildParameters, buildMapContext);
|
EncryptingBundleFiles(buildParameters, buildMapContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,17 +23,11 @@ namespace YooAsset.Editor
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除包裹目录
|
// 检测不被支持的构建模式
|
||||||
if (buildParameters.ClearBuildCacheFiles)
|
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
|
||||||
{
|
{
|
||||||
// Deletes the build cache directory.
|
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !");
|
||||||
UnityEditor.Build.Pipeline.Utilities.BuildCache.PurgeCache(false);
|
throw new Exception(message);
|
||||||
|
|
||||||
string packageRootDirectory = buildParameters.GetPackageRootDirectory();
|
|
||||||
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
|
||||||
{
|
|
||||||
BuildLogger.Log($"Delete package root directory: {packageRootDirectory}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测包裹输出目录是否存在
|
// 检测包裹输出目录是否存在
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace YooAsset.Editor
|
||||||
BuildinFileRootIsNullOrEmpty = 114,
|
BuildinFileRootIsNullOrEmpty = 114,
|
||||||
PackageOutputDirectoryExists = 115,
|
PackageOutputDirectoryExists = 115,
|
||||||
RecommendScriptBuildPipeline = 130,
|
RecommendScriptBuildPipeline = 130,
|
||||||
|
BuildPipelineNotSupportBuildMode = 140,
|
||||||
|
|
||||||
// TaskGetBuildMap
|
// TaskGetBuildMap
|
||||||
RemoveInvalidTags = 200,
|
RemoveInvalidTags = 200,
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 资源包流水线的构建模式
|
||||||
|
/// </summary>
|
||||||
|
public enum EBuildMode
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 强制重建模式
|
||||||
|
/// </summary>
|
||||||
|
ForceRebuild,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 增量构建模式
|
||||||
|
/// </summary>
|
||||||
|
IncrementalBuild,
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 720a3c8ecde4cd443bedd238c03713c0
|
guid: 0b6f2523a865e454d8fa3f48a2852d5a
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
|
@ -27,7 +27,6 @@ namespace YooAsset.Editor
|
||||||
private EnumField _outputNameStyleField;
|
private EnumField _outputNameStyleField;
|
||||||
private EnumField _copyBuildinFileOptionField;
|
private EnumField _copyBuildinFileOptionField;
|
||||||
private TextField _copyBuildinFileTagsField;
|
private TextField _copyBuildinFileTagsField;
|
||||||
private Toggle _clearBuildCacheToggle;
|
|
||||||
|
|
||||||
public BuildPipelineViewerBase(string packageName, EBuildPipeline buildPipeline, BuildTarget buildTarget, VisualElement parent)
|
public BuildPipelineViewerBase(string packageName, EBuildPipeline buildPipeline, BuildTarget buildTarget, VisualElement parent)
|
||||||
{
|
{
|
||||||
|
@ -60,6 +59,24 @@ namespace YooAsset.Editor
|
||||||
_buildVersionField.style.width = StyleWidth;
|
_buildVersionField.style.width = StyleWidth;
|
||||||
_buildVersionField.SetValueWithoutNotify(GetDefaultPackageVersion());
|
_buildVersionField.SetValueWithoutNotify(GetDefaultPackageVersion());
|
||||||
|
|
||||||
|
// 构建模式
|
||||||
|
{
|
||||||
|
var buildModeContainer = Root.Q("BuildModeContainer");
|
||||||
|
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
||||||
|
var buildModeList = GetSupportBuildModes();
|
||||||
|
int defaultIndex = buildModeList.FindIndex(x => x.Equals(buildMode));
|
||||||
|
if (defaultIndex < 0)
|
||||||
|
defaultIndex = (int)(EBuildMode)buildModeList[0];
|
||||||
|
_buildModeField = new PopupField<Enum>(buildModeList, defaultIndex);
|
||||||
|
_buildModeField.label = "Build Mode";
|
||||||
|
_buildModeField.style.width = StyleWidth;
|
||||||
|
_buildModeField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
AssetBundleBuilderSetting.SetPackageBuildMode(PackageName, BuildPipeline, (EBuildMode)_buildModeField.value);
|
||||||
|
});
|
||||||
|
buildModeContainer.Add(_buildModeField);
|
||||||
|
}
|
||||||
|
|
||||||
// 加密方法
|
// 加密方法
|
||||||
{
|
{
|
||||||
var encryptionContainer = Root.Q("EncryptionContainer");
|
var encryptionContainer = Root.Q("EncryptionContainer");
|
||||||
|
@ -131,15 +148,6 @@ namespace YooAsset.Editor
|
||||||
AssetBundleBuilderSetting.SetPackageBuildinFileCopyParams(PackageName, BuildPipeline, _copyBuildinFileTagsField.value);
|
AssetBundleBuilderSetting.SetPackageBuildinFileCopyParams(PackageName, BuildPipeline, _copyBuildinFileTagsField.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 清理构建缓存
|
|
||||||
bool clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, BuildPipeline);
|
|
||||||
_clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
|
||||||
_clearBuildCacheToggle.SetValueWithoutNotify(clearBuildCache);
|
|
||||||
_clearBuildCacheToggle.RegisterValueChangedCallback(evt =>
|
|
||||||
{
|
|
||||||
AssetBundleBuilderSetting.SetPackageClearBuildCache(PackageName, BuildPipeline, _clearBuildCacheToggle.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 构建按钮
|
// 构建按钮
|
||||||
var buildButton = Root.Q<Button>("Build");
|
var buildButton = Root.Q<Button>("Build");
|
||||||
buildButton.clicked += BuildButton_clicked;
|
buildButton.clicked += BuildButton_clicked;
|
||||||
|
@ -152,7 +160,8 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
private void BuildButton_clicked()
|
private void BuildButton_clicked()
|
||||||
{
|
{
|
||||||
if (EditorUtility.DisplayDialog("提示", $"开始构建资源包[{PackageName}]!", "Yes", "No"))
|
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
||||||
|
if (EditorUtility.DisplayDialog("提示", $"通过构建模式【{buildMode}】来构建!", "Yes", "No"))
|
||||||
{
|
{
|
||||||
EditorTools.ClearUnityConsole();
|
EditorTools.ClearUnityConsole();
|
||||||
EditorApplication.delayCall += ExecuteBuild;
|
EditorApplication.delayCall += ExecuteBuild;
|
||||||
|
@ -168,6 +177,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract void ExecuteBuild();
|
protected abstract void ExecuteBuild();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取构建管线支持的构建模式集合
|
||||||
|
/// </summary>
|
||||||
|
protected abstract List<Enum> GetSupportBuildModes();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取构建版本
|
/// 获取构建版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<ui:VisualElement name="BuildContainer">
|
<ui:VisualElement name="BuildContainer">
|
||||||
<ui:TextField picking-mode="Ignore" label="Build Output" name="BuildOutput" />
|
<ui:TextField picking-mode="Ignore" label="Build Output" name="BuildOutput" />
|
||||||
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
||||||
<ui:Toggle label="Clear Build Cache" name="ClearBuildCache" />
|
<ui:VisualElement name="BuildModeContainer" style="height: 24px;" />
|
||||||
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
|
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
|
||||||
<uie:EnumField label="Compression" value="Center" name="Compression" />
|
<uie:EnumField label="Compression" value="Center" name="Compression" />
|
||||||
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
||||||
|
|
|
@ -22,17 +22,18 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
|
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||||
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, BuildPipeline);
|
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, BuildPipeline);
|
||||||
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, BuildPipeline);
|
|
||||||
|
|
||||||
BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
|
BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
|
buildParameters.BuildMode = buildMode;
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
buildParameters.EnableSharePackRule = true;
|
buildParameters.EnableSharePackRule = true;
|
||||||
|
@ -40,15 +41,22 @@ namespace YooAsset.Editor
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
||||||
buildParameters.CompressOption = compressOption;
|
|
||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
||||||
|
buildParameters.CompressOption = compressOption;
|
||||||
|
|
||||||
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override List<Enum> GetSupportBuildModes()
|
||||||
|
{
|
||||||
|
List<Enum> buildModeList = new List<Enum>();
|
||||||
|
buildModeList.Add(EBuildMode.ForceRebuild);
|
||||||
|
buildModeList.Add(EBuildMode.IncrementalBuild);
|
||||||
|
return buildModeList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -36,6 +36,7 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
|
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||||
|
@ -45,6 +46,7 @@ namespace YooAsset.Editor
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
|
buildParameters.BuildMode = buildMode;
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
|
@ -58,6 +60,13 @@ namespace YooAsset.Editor
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override List<Enum> GetSupportBuildModes()
|
||||||
|
{
|
||||||
|
List<Enum> buildModeList = new List<Enum>();
|
||||||
|
buildModeList.Add(EBuildMode.ForceRebuild);
|
||||||
|
return buildModeList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -24,23 +24,23 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
|
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||||
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, BuildPipeline);
|
|
||||||
|
|
||||||
RawFileBuildParameters buildParameters = new RawFileBuildParameters();
|
RawFileBuildParameters buildParameters = new RawFileBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
|
buildParameters.BuildMode = buildMode;
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
||||||
|
|
||||||
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
||||||
|
@ -48,6 +48,13 @@ namespace YooAsset.Editor
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override List<Enum> GetSupportBuildModes()
|
||||||
|
{
|
||||||
|
List<Enum> buildModeList = new List<Enum>();
|
||||||
|
buildModeList.Add(EBuildMode.ForceRebuild);
|
||||||
|
return buildModeList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -22,17 +22,18 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
|
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||||
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, BuildPipeline);
|
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, BuildPipeline);
|
||||||
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, BuildPipeline);
|
|
||||||
|
|
||||||
ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
|
ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
|
buildParameters.BuildMode = buildMode;
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
buildParameters.EnableSharePackRule = true;
|
buildParameters.EnableSharePackRule = true;
|
||||||
|
@ -40,15 +41,21 @@ namespace YooAsset.Editor
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
||||||
buildParameters.CompressOption = compressOption;
|
|
||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
||||||
|
buildParameters.CompressOption = compressOption;
|
||||||
|
|
||||||
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override List<Enum> GetSupportBuildModes()
|
||||||
|
{
|
||||||
|
List<Enum> buildModeList = new List<Enum>();
|
||||||
|
buildModeList.Add(EBuildMode.IncrementalBuild);
|
||||||
|
return buildModeList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -46,7 +46,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 检测分组是否激活
|
// 检测分组是否激活
|
||||||
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(ActiveRuleName);
|
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(ActiveRuleName);
|
||||||
if (activeRule.IsActiveGroup(new GroupData(GroupName)) == false)
|
if (activeRule.IsActiveGroup() == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var collector in Collectors)
|
foreach (var collector in Collectors)
|
||||||
|
@ -80,7 +80,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 检测分组是否激活
|
// 检测分组是否激活
|
||||||
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(ActiveRuleName);
|
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(ActiveRuleName);
|
||||||
if (activeRule.IsActiveGroup(new GroupData(GroupName)) == false)
|
if (activeRule.IsActiveGroup() == false)
|
||||||
{
|
{
|
||||||
return new List<CollectAssetInfo>();
|
return new List<CollectAssetInfo>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -657,7 +657,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 激活状态
|
// 激活状态
|
||||||
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(group.ActiveRuleName);
|
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(group.ActiveRuleName);
|
||||||
bool isActive = activeRule.IsActiveGroup(new GroupData(group.GroupName));
|
bool isActive = activeRule.IsActiveGroup();
|
||||||
textField1.SetEnabled(isActive);
|
textField1.SetEnabled(isActive);
|
||||||
}
|
}
|
||||||
private void GroupListView_onSelectionChange(IEnumerable<object> objs)
|
private void GroupListView_onSelectionChange(IEnumerable<object> objs)
|
||||||
|
|
|
@ -1,16 +1,6 @@
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public struct GroupData
|
|
||||||
{
|
|
||||||
public string GroupName;
|
|
||||||
|
|
||||||
public GroupData(string groupName)
|
|
||||||
{
|
|
||||||
GroupName = groupName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源分组激活规则接口
|
/// 资源分组激活规则接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -19,6 +9,6 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否激活分组
|
/// 是否激活分组
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsActiveGroup(GroupData data);
|
bool IsActiveGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ namespace YooAsset.Editor
|
||||||
[DisplayName("启用分组")]
|
[DisplayName("启用分组")]
|
||||||
public class EnableGroup : IActiveRule
|
public class EnableGroup : IActiveRule
|
||||||
{
|
{
|
||||||
public bool IsActiveGroup(GroupData data)
|
public bool IsActiveGroup()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace YooAsset.Editor
|
||||||
[DisplayName("禁用分组")]
|
[DisplayName("禁用分组")]
|
||||||
public class DisableGroup : IActiveRule
|
public class DisableGroup : IActiveRule
|
||||||
{
|
{
|
||||||
public bool IsActiveGroup(GroupData data)
|
public bool IsActiveGroup()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildTarget BuildTarget;
|
public BuildTarget BuildTarget;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构建模式
|
||||||
|
/// </summary>
|
||||||
|
public EBuildMode BuildMode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建管线
|
/// 构建管线
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -62,7 +67,6 @@ namespace YooAsset.Editor
|
||||||
public string IgnoreRuleName;
|
public string IgnoreRuleName;
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
public bool ClearBuildCacheFiles;
|
|
||||||
public bool EnableSharePackRule;
|
public bool EnableSharePackRule;
|
||||||
public string EncryptionClassName;
|
public string EncryptionClassName;
|
||||||
public EFileNameStyle FileNameStyle;
|
public EFileNameStyle FileNameStyle;
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace YooAsset.Editor
|
||||||
_items.Add(new ItemWrapper("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds)));
|
_items.Add(new ItemWrapper("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds)));
|
||||||
_items.Add(new ItemWrapper("Build Target", $"{buildReport.Summary.BuildTarget}"));
|
_items.Add(new ItemWrapper("Build Target", $"{buildReport.Summary.BuildTarget}"));
|
||||||
_items.Add(new ItemWrapper("Build Pipeline", $"{buildReport.Summary.BuildPipeline}"));
|
_items.Add(new ItemWrapper("Build Pipeline", $"{buildReport.Summary.BuildPipeline}"));
|
||||||
|
_items.Add(new ItemWrapper("Build Mode", $"{buildReport.Summary.BuildMode}"));
|
||||||
_items.Add(new ItemWrapper("Package Name", buildReport.Summary.BuildPackageName));
|
_items.Add(new ItemWrapper("Package Name", buildReport.Summary.BuildPackageName));
|
||||||
_items.Add(new ItemWrapper("Package Version", buildReport.Summary.BuildPackageVersion));
|
_items.Add(new ItemWrapper("Package Version", buildReport.Summary.BuildPackageVersion));
|
||||||
_items.Add(new ItemWrapper("Package Note", buildReport.Summary.BuildPackageNote));
|
_items.Add(new ItemWrapper("Package Note", buildReport.Summary.BuildPackageNote));
|
||||||
|
@ -77,7 +78,6 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||||
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
||||||
_items.Add(new ItemWrapper("Clear Build Cache Files", $"{buildReport.Summary.ClearBuildCacheFiles}"));
|
|
||||||
_items.Add(new ItemWrapper("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}"));
|
_items.Add(new ItemWrapper("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}"));
|
||||||
_items.Add(new ItemWrapper("Encryption Class Name", buildReport.Summary.EncryptionClassName));
|
_items.Add(new ItemWrapper("Encryption Class Name", buildReport.Summary.EncryptionClassName));
|
||||||
_items.Add(new ItemWrapper("FileNameStyle", $"{buildReport.Summary.FileNameStyle}"));
|
_items.Add(new ItemWrapper("FileNameStyle", $"{buildReport.Summary.FileNameStyle}"));
|
||||||
|
|
|
@ -3,6 +3,27 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 默认的构建管线
|
||||||
|
/// </summary>
|
||||||
|
public enum EDefaultBuildPipeline
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 内置构建管线
|
||||||
|
/// </summary>
|
||||||
|
BuiltinBuildPipeline,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 可编程构建管线
|
||||||
|
/// </summary>
|
||||||
|
ScriptableBuildPipeline,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原生文件构建管线
|
||||||
|
/// </summary>
|
||||||
|
RawFileBuildPipeline,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 运行模式
|
/// 运行模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -68,7 +89,7 @@ namespace YooAsset
|
||||||
/// 创建默认的编辑器文件系统参数
|
/// 创建默认的编辑器文件系统参数
|
||||||
/// <param name="simulateBuildResult">模拟构建结果</param>
|
/// <param name="simulateBuildResult">模拟构建结果</param>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static FileSystemParameters CreateDefaultEditorFileSystemParameters(EditorSimulateBuildResult simulateBuildResult)
|
public static FileSystemParameters CreateDefaultEditorFileSystemParameters(SimulateBuildResult simulateBuildResult)
|
||||||
{
|
{
|
||||||
string fileSystemClass = typeof(DefaultEditorFileSystem).FullName;
|
string fileSystemClass = typeof(DefaultEditorFileSystem).FullName;
|
||||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, simulateBuildResult.PackageRootDirectory);
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, simulateBuildResult.PackageRootDirectory);
|
||||||
|
|
|
@ -58,7 +58,6 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注意:调用底层接口释放所有资源
|
// 注意:调用底层接口释放所有资源
|
||||||
if (removeList.Count > 0)
|
|
||||||
Resources.UnloadUnusedAssets();
|
Resources.UnloadUnusedAssets();
|
||||||
|
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
public class EditorSimulateBuildParam
|
|
||||||
{
|
|
||||||
public string PackageName;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public class EditorSimulateBuildResult
|
public class SimulateBuildResult
|
||||||
{
|
{
|
||||||
public string PackageRootDirectory;
|
public string PackageRootDirectory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,20 @@ namespace YooAsset
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑器下模拟构建清单
|
/// 编辑器下模拟构建清单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
|
public static SimulateBuildResult SimulateBuild(string buildPipelineName, string packageName)
|
||||||
{
|
{
|
||||||
if (_classType == null)
|
if (_classType == null)
|
||||||
_classType = Assembly.Load("YooAsset.Editor").GetType("YooAsset.Editor.AssetBundleSimulateBuilder");
|
_classType = Assembly.Load("YooAsset.Editor").GetType("YooAsset.Editor.AssetBundleSimulateBuilder");
|
||||||
|
|
||||||
return (EditorSimulateBuildResult)InvokePublicStaticMethod(_classType, "SimulateBuild", buildParam);
|
return (SimulateBuildResult)InvokePublicStaticMethod(_classType, "SimulateBuild", buildPipelineName, packageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑器下模拟构建清单
|
||||||
|
/// </summary>
|
||||||
|
public static SimulateBuildResult SimulateBuild(EDefaultBuildPipeline buildPipeline, string packageName)
|
||||||
|
{
|
||||||
|
return SimulateBuild(buildPipeline.ToString(), packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
|
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
|
||||||
|
@ -35,7 +43,12 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
public static class EditorSimulateModeHelper
|
public static class EditorSimulateModeHelper
|
||||||
{
|
{
|
||||||
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
|
public static SimulateBuildResult SimulateBuild(string buildPipelineName, string packageName)
|
||||||
|
{
|
||||||
|
throw new System.Exception("Only support in unity editor !");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SimulateBuildResult SimulateBuild(EDefaultBuildPipeline buildPipeline, string packageName)
|
||||||
{
|
{
|
||||||
throw new System.Exception("Only support in unity editor !");
|
throw new System.Exception("Only support in unity editor !");
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ public static class ShaderVariantCollector
|
||||||
List<string> allAssets = new List<string>(1000);
|
List<string> allAssets = new List<string>(1000);
|
||||||
|
|
||||||
// 获取所有打包的资源
|
// 获取所有打包的资源
|
||||||
CollectResult collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(true, _packageName);
|
CollectResult collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(EBuildMode.DryRunBuild, _packageName);
|
||||||
foreach (var assetInfo in collectResult.CollectAssets)
|
foreach (var assetInfo in collectResult.CollectAssets)
|
||||||
{
|
{
|
||||||
string[] depends = AssetDatabase.GetDependencies(assetInfo.AssetInfo.AssetPath, true);
|
string[] depends = AssetDatabase.GetDependencies(assetInfo.AssetInfo.AssetPath, true);
|
||||||
|
|
|
@ -1,102 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using YooAsset;
|
|
||||||
|
|
||||||
public static class YooAssetsExtension
|
|
||||||
{
|
|
||||||
public static LoadGameObjectOperation LoadGameObjectAsync(this ResourcePackage resourcePackage, string location, Vector3 position, Quaternion rotation, Transform parent, bool destroyGoOnRelease = false)
|
|
||||||
{
|
|
||||||
var operation = new LoadGameObjectOperation(location, position, rotation, parent, destroyGoOnRelease);
|
|
||||||
YooAssets.StartOperation(operation);
|
|
||||||
return operation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LoadGameObjectOperation : GameAsyncOperation
|
|
||||||
{
|
|
||||||
private enum ESteps
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
LoadAsset,
|
|
||||||
Done,
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly string _location;
|
|
||||||
private readonly Vector3 _positon;
|
|
||||||
private readonly Quaternion _rotation;
|
|
||||||
private readonly Transform _parent;
|
|
||||||
private readonly bool _destroyGoOnRelease;
|
|
||||||
private AssetHandle _handle;
|
|
||||||
private ESteps _steps = ESteps.None;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载的游戏对象
|
|
||||||
/// </summary>
|
|
||||||
public GameObject Go { private set; get; }
|
|
||||||
|
|
||||||
|
|
||||||
public LoadGameObjectOperation(string location, Vector3 position, Quaternion rotation, Transform parent, bool destroyGoOnRelease = false)
|
|
||||||
{
|
|
||||||
_location = location;
|
|
||||||
_positon = position;
|
|
||||||
_rotation = rotation;
|
|
||||||
_parent = parent;
|
|
||||||
_destroyGoOnRelease = destroyGoOnRelease;
|
|
||||||
}
|
|
||||||
protected override void OnStart()
|
|
||||||
{
|
|
||||||
_steps = ESteps.LoadAsset;
|
|
||||||
}
|
|
||||||
protected override void OnUpdate()
|
|
||||||
{
|
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_steps == ESteps.LoadAsset)
|
|
||||||
{
|
|
||||||
if (_handle == null)
|
|
||||||
{
|
|
||||||
_handle = YooAssets.LoadAssetAsync<GameObject>(_location);
|
|
||||||
}
|
|
||||||
|
|
||||||
Progress = _handle.Progress;
|
|
||||||
if (_handle.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_handle.Status != EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
Error = _handle.LastError;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Go = _handle.InstantiateSync(_positon, _rotation, _parent);
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected override void OnAbort()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放资源句柄
|
|
||||||
/// </summary>
|
|
||||||
public void ReleaseHandle()
|
|
||||||
{
|
|
||||||
if (_handle != null)
|
|
||||||
{
|
|
||||||
_handle.Release();
|
|
||||||
|
|
||||||
if (_destroyGoOnRelease)
|
|
||||||
{
|
|
||||||
if (Go != null)
|
|
||||||
GameObject.Destroy(Go);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 55478908ad5dc5541af1529a3faccee7
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -33,6 +33,7 @@ internal class FsmInitializePackage : IStateNode
|
||||||
{
|
{
|
||||||
var playMode = (EPlayMode)_machine.GetBlackboardValue("PlayMode");
|
var playMode = (EPlayMode)_machine.GetBlackboardValue("PlayMode");
|
||||||
var packageName = (string)_machine.GetBlackboardValue("PackageName");
|
var packageName = (string)_machine.GetBlackboardValue("PackageName");
|
||||||
|
var buildPipeline = (string)_machine.GetBlackboardValue("BuildPipeline");
|
||||||
var rawFileSystem = (bool)_machine.GetBlackboardValue("RawFileSystem");
|
var rawFileSystem = (bool)_machine.GetBlackboardValue("RawFileSystem");
|
||||||
|
|
||||||
// 创建资源包裹类
|
// 创建资源包裹类
|
||||||
|
@ -44,9 +45,7 @@ internal class FsmInitializePackage : IStateNode
|
||||||
InitializationOperation initializationOperation = null;
|
InitializationOperation initializationOperation = null;
|
||||||
if (playMode == EPlayMode.EditorSimulateMode)
|
if (playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
var simulateBuildParam = new EditorSimulateBuildParam();
|
var simulateBuildResult = EditorSimulateModeHelper.SimulateBuild(buildPipeline, packageName);
|
||||||
simulateBuildParam.PackageName = packageName;
|
|
||||||
var simulateBuildResult = EditorSimulateModeHelper.SimulateBuild(simulateBuildParam);
|
|
||||||
var createParameters = new EditorSimulateModeParameters();
|
var createParameters = new EditorSimulateModeParameters();
|
||||||
createParameters.EditorFileSystemParameters = FileSystemParameters.CreateDefaultEditorFileSystemParameters(simulateBuildResult);
|
createParameters.EditorFileSystemParameters = FileSystemParameters.CreateDefaultEditorFileSystemParameters(simulateBuildResult);
|
||||||
initializationOperation = package.InitializeAsync(createParameters);
|
initializationOperation = package.InitializeAsync(createParameters);
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class PatchOperation : GameAsyncOperation
|
||||||
private readonly StateMachine _machine;
|
private readonly StateMachine _machine;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
public PatchOperation(string packageName, bool rawFileSystem, EPlayMode playMode)
|
public PatchOperation(string packageName, string buildPipeline, bool rawFileSystem, EPlayMode playMode)
|
||||||
{
|
{
|
||||||
// 注册监听事件
|
// 注册监听事件
|
||||||
_eventGroup.AddListener<UserEventDefine.UserTryInitialize>(OnHandleEventMessage);
|
_eventGroup.AddListener<UserEventDefine.UserTryInitialize>(OnHandleEventMessage);
|
||||||
|
@ -41,6 +41,7 @@ public class PatchOperation : GameAsyncOperation
|
||||||
|
|
||||||
_machine.SetBlackboardValue("PackageName", packageName);
|
_machine.SetBlackboardValue("PackageName", packageName);
|
||||||
_machine.SetBlackboardValue("PlayMode", playMode);
|
_machine.SetBlackboardValue("PlayMode", playMode);
|
||||||
|
_machine.SetBlackboardValue("BuildPipeline", buildPipeline);
|
||||||
_machine.SetBlackboardValue("RawFileSystem", rawFileSystem);
|
_machine.SetBlackboardValue("RawFileSystem", rawFileSystem);
|
||||||
}
|
}
|
||||||
protected override void OnStart()
|
protected override void OnStart()
|
||||||
|
|
Loading…
Reference in New Issue