00 精简打包设置

This commit is contained in:
2025-04-27 10:22:16 +08:00
parent 0042772a1b
commit ddcc3653d7
5 changed files with 122 additions and 94 deletions

View File

@@ -13,7 +13,7 @@ namespace Stary.Evo.Editor
{
public void OnEnable()
{
buildTarget = EditorUserBuildSettings.activeBuildTarget.ToString();
GetPackageVersion();
oldVersionX = packageVersionX;
oldVersionY = packageVersionY;
@@ -33,60 +33,76 @@ namespace Stary.Evo.Editor
[OnValueChanged("SetEnvironmentType")]
public EnvironmentType environmentType;
[Title("当前打包平台", titleAlignment: TitleAlignments.Centered)]
[ReadOnly]
[Title("构建列表", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("BuildSetting"), HideLabel]
public string buildTarget;
[OnValueChanged("SetBuildPipelines")]
public EBuildPipeline selectedBuildPipelines;
private const string VerSersionMessage = "(小版本由打包叠加,中版本、大版本更新会重置小版本,如误操作,点击重置按钮即可)";
[TitleGroup("当前打包版本号", alignment: TitleAlignments.Centered)]
[Title("版本号", titleAlignment: TitleAlignments.Centered)]
[ReadOnly]
[HorizontalGroup("当前打包版本号/PackageVersion"), HideLabel]
[HorizontalGroup("BuildSetting/PackageVersion"), HideLabel]
public string packageVersion;
[HorizontalGroup("当前打包版本号/PackageVersion"), HideLabel, EnumToggleButtons]
[Title("版本设置切换", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("BuildSetting/PackageVersion"), HideLabel, EnumToggleButtons]
[HideIf("environmentType", EnvironmentType.Debug)]
public VersionPosType VersionType;
[HorizontalGroup("当前打包版本号/PackageVersion"), HideLabel, Button(Icon = SdfIconType.Plus)]
[Title("升级版本", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("BuildSetting/PackageVersion"), HideLabel, Button(Icon = SdfIconType.Plus)]
[HideIf("environmentType", EnvironmentType.Debug)]
public void AddBigVersion()
{
if (VersionType == VersionPosType.X)
{
packageVersionX++;
if (packageVersionZ > 0)
packageVersionZ = 0;
}
else if (VersionType == VersionPosType.Y)
{
packageVersionY++;
if (packageVersionZ > 0)
packageVersionZ = 0;
}else if (VersionType == VersionPosType.Z)
{
packageVersionZ++;
}
if (packageVersionZ > 0)
packageVersionZ = 0;
GetPackageVersion();
}
[HorizontalGroup("当前打包版本号/PackageVersion"), HideLabel, Button(Icon = SdfIconType.Dash)]
[Title("降低版本", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("BuildSetting/PackageVersion"), HideLabel, Button(Icon = SdfIconType.Dash)]
[HideIf("environmentType", EnvironmentType.Debug)]
public void SubBigVersion()
{
if (VersionType == VersionPosType.X)
{
packageVersionX--;
if (packageVersionZ > 0)
packageVersionZ = 0;
}
else if (VersionType == VersionPosType.Y)
{
packageVersionY--;
if (packageVersionZ > 0)
packageVersionZ = 0;
}else if (VersionType == VersionPosType.Z)
{
packageVersionZ--;
if (packageVersionZ < 0)
packageVersionZ = 0;
}
if (packageVersionZ > 0)
packageVersionZ = 0;
GetPackageVersion();
}
[HorizontalGroup("当前打包版本号/PackageVersion"), HideLabel, Button(Icon = SdfIconType.ArrowRepeat)]
[Title("重置版本", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("BuildSetting/PackageVersion"), HideLabel, Button(Icon = SdfIconType.ArrowRepeat)]
[HideIf("environmentType", EnvironmentType.Debug)]
public void RepeatVersion()
{
@@ -96,16 +112,13 @@ namespace Stary.Evo.Editor
GetPackageVersion();
}
[Title("构建列表", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("BuildPipeline"), HideLabel]
[OnValueChanged("SetBuildPipelines")]
public EBuildPipeline selectedBuildPipelines;
[Title("加密列表", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("BuildPipeline"), HideLabel]
[ValueDropdown("GetEncryptionServices")]
[OnValueChanged("SetEncryptionServices")]
public Type encryption;
//
// [Title("加密列表", titleAlignment: TitleAlignments.Centered)]
// [HorizontalGroup("BuildPipeline"), HideLabel]
// [ValueDropdown("GetEncryptionServices")]
// [OnValueChanged("SetEncryptionServices")]
// public Type encryption;
[HideLabel] public AbstractBuildPipelineViewer viewer;
@@ -161,6 +174,7 @@ namespace Stary.Evo.Editor
$"{packageVersionX}.{packageVersionY}.{packageVersionZ}";
}
SetBuildPipelines();
viewer.SetBuildCacheToggle();
EditorUtility.SetDirty(this);
AssetDatabase.SaveAssets();
@@ -209,28 +223,29 @@ namespace Stary.Evo.Editor
}
}
private List<Type> GetEncryptionServices()
{
var encryptionClassTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
if (encryption.IsNull())
{
encryption = encryptionClassTypes[0];
}
return encryptionClassTypes;
}
private void SetEncryptionServices()
{
AssetBundleBuilderSetting.SetPackageEncyptionClassName(packageName, selectedBuildPipelines,
encryption.FullName);
}
// private List<Type> GetEncryptionServices()
// {
// var encryptionClassTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
// if (encryption.IsNull())
// {
// encryption = encryptionClassTypes[0];
// }
//
// return encryptionClassTypes;
// }
//
// private void SetEncryptionServices()
// {
// AssetBundleBuilderSetting.SetPackageEncyptionClassName(packageName, selectedBuildPipelines,
// encryption.FullName);
// }
}
public enum VersionPosType
{
X,
Y,
Z,
}
public enum EnvironmentType