00 精简打包设置
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -26,21 +26,21 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
public class BuildAssetWindow : OdinEditorWindow
|
||||
{
|
||||
|
||||
private static BuildAssetWindow window;
|
||||
|
||||
[MenuItem("Evo/资源打包工具")]
|
||||
static void ShowWindows()
|
||||
{
|
||||
if (CreatAssetWindow.GetCreatDomainAll().Count <= 0)
|
||||
{
|
||||
EditorUtility.DisplayDialog("提示", "不存在Domain元素,无法打开此面板,请先创建Domain元素", "确定" );
|
||||
EditorUtility.DisplayDialog("提示", "不存在Domain元素,无法打开此面板,请先创建Domain元素", "确定");
|
||||
return;
|
||||
}
|
||||
|
||||
window = (BuildAssetWindow)EditorWindow.GetWindow(typeof(BuildAssetWindow));
|
||||
window.Show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
@@ -50,9 +50,10 @@ namespace Stary.Evo.Editor
|
||||
|
||||
public static void RemoveBuildAssetWindow()
|
||||
{
|
||||
if(window != null)
|
||||
window.Close();
|
||||
if (window != null)
|
||||
window.Close();
|
||||
}
|
||||
|
||||
protected void OnSelectionChange()
|
||||
{
|
||||
EditorUtility.SetDirty(BuildAssetDataSetting);
|
||||
@@ -65,18 +66,26 @@ namespace Stary.Evo.Editor
|
||||
[ValueDropdown("GetBuildPackageNames")]
|
||||
[OnValueChanged("SetBuildPackageNames")]
|
||||
public string selectedPackageNames;
|
||||
|
||||
|
||||
[Title("当前打包平台", titleAlignment: TitleAlignments.Centered)]
|
||||
[ReadOnly]
|
||||
[HorizontalGroup("BuildPipeline"), HideLabel]
|
||||
public string buildTarget;
|
||||
|
||||
public static string packageName;
|
||||
|
||||
#region HyBridCLRBuild
|
||||
|
||||
[HideIf("@ packageName== \"Main\"")]
|
||||
[Title("HyBridCLRBuild", titleAlignment: TitleAlignments.Centered)] [HideLabel]
|
||||
[Title("HyBridCLRBuild", titleAlignment: TitleAlignments.Centered)]
|
||||
[HideLabel]
|
||||
public BuildAssetEntity hyBridClrBuildEntity =
|
||||
new BuildAssetEntity("HyBridCLRBuild", "DllBuildTarget", () =>
|
||||
{
|
||||
//PrebuildCommand.GenerateAll();
|
||||
CompileDllCommand.CompileDllActiveBuildTarget();
|
||||
});
|
||||
new BuildAssetEntity("HyBridCLRBuild", "DllBuildTarget", () =>
|
||||
{
|
||||
//PrebuildCommand.GenerateAll();
|
||||
CompileDllCommand.CompileDllActiveBuildTarget();
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -90,10 +99,8 @@ namespace Stary.Evo.Editor
|
||||
|
||||
#region BuildAsset
|
||||
|
||||
|
||||
|
||||
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)]
|
||||
[HideLabel] public BuildAssetDataSetting BuildAssetDataSetting;
|
||||
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)] [HideLabel]
|
||||
public BuildAssetDataSetting BuildAssetDataSetting;
|
||||
|
||||
/// <summary>
|
||||
/// 检测当前所有包裹
|
||||
@@ -102,7 +109,7 @@ namespace Stary.Evo.Editor
|
||||
private List<string> GetBuildPackageNames()
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
foreach (var name in CreatAssetWindow.GetCreatDomainAllName())
|
||||
foreach (var name in CreatAssetWindow.GetCreatDomainAllName())
|
||||
{
|
||||
result.Add(name);
|
||||
}
|
||||
@@ -118,9 +125,8 @@ namespace Stary.Evo.Editor
|
||||
// {
|
||||
selectedPackageNames = result[0];
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
SetBuildPackageNames();
|
||||
return result;
|
||||
}
|
||||
@@ -148,6 +154,7 @@ namespace Stary.Evo.Editor
|
||||
Debug.LogError($"UnityEvo:BuildAssetDataSetting 不存在,请检查路径{buildAssetDataSettingPath}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前包裹
|
||||
/// </summary>
|
||||
@@ -156,6 +163,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
return packageName;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Update
|
||||
@@ -164,7 +172,8 @@ namespace Stary.Evo.Editor
|
||||
public BuildAssetEntity onBuildPipelineEntity;
|
||||
|
||||
[FormerlySerializedAs("UpdateServerPath")]
|
||||
[TitleGroup("UpdateAssetButton", alignment: TitleAlignments.Centered)][ShowIf("@ BuildAssetDataSetting.environmentType== EnvironmentType.Release",true)]
|
||||
[TitleGroup("UpdateAssetButton", alignment: TitleAlignments.Centered)]
|
||||
[ShowIf("@ BuildAssetDataSetting.environmentType== EnvironmentType.Release", true)]
|
||||
[ReadOnly]
|
||||
[InfoBox("服务器资源盘位未存在", InfoMessageType.Error, "@ _isCheckDriveExist==false")]
|
||||
[InfoBox("1、映射网络驱动器\n2、添加http://192.168.31.100:5005/alist/HotRefresh地址\n3、设置盘符为Z盘", InfoMessageType.Info,
|
||||
@@ -174,7 +183,10 @@ namespace Stary.Evo.Editor
|
||||
|
||||
private bool _isCheckDriveExist;
|
||||
|
||||
[TitleGroup("UpdateAssetButton", alignment: TitleAlignments.Centered)] [HideLabel][ShowIf("@ _isCheckDriveExist&&BuildAssetDataSetting.environmentType== EnvironmentType.Release&&selectedPackageNames!=\"Main\"")]
|
||||
[TitleGroup("UpdateAssetButton", alignment: TitleAlignments.Centered)]
|
||||
[HideLabel]
|
||||
[ShowIf(
|
||||
"@ _isCheckDriveExist&&BuildAssetDataSetting.environmentType== EnvironmentType.Release&&selectedPackageNames!=\"Main\"")]
|
||||
public BuildAssetEntity onUpdateBuildPipelineEntity;
|
||||
|
||||
|
||||
@@ -187,24 +199,22 @@ namespace Stary.Evo.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Debug.LogWarning("[Build] 打包已经取消");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUpdateBuildPipeline()
|
||||
{
|
||||
|
||||
if (EditorUtility.DisplayDialog("提示", $"开始上传至服务器[{selectedPackageNames}]!", "Yes", "No"))
|
||||
{
|
||||
Stary.Evo.Editor.FileUtility.CopyDirectory(
|
||||
$"{AssetBundleBuilderHelper.GetDefaultBuildOutputRoot()}/{EditorUserBuildSettings.activeBuildTarget}/{BuildAssetDataSetting.packageName}/{BuildAssetDataSetting.packageVersion}",
|
||||
updateServerPath);
|
||||
CreatePackageVersionJson();
|
||||
|
||||
|
||||
|
||||
|
||||
BuildAssetDataSetting.GetBuildPackageVersion(true);
|
||||
|
||||
|
||||
EditorUtility.DisplayDialog("提示", $"上传服务器完成!", "确定");
|
||||
}
|
||||
else
|
||||
@@ -214,18 +224,17 @@ namespace Stary.Evo.Editor
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void Init()
|
||||
|
||||
protected void Init()
|
||||
{
|
||||
//Update
|
||||
//检测Z盘
|
||||
_isCheckDriveExist = Stary.Evo.Editor.FileUtility.CheckDriveExists("Z");
|
||||
|
||||
buildTarget = EditorUserBuildSettings.activeBuildTarget.ToString();
|
||||
onBuildPipelineEntity =
|
||||
new BuildAssetEntity("打包", $"打包资源包【版本:{BuildAssetDataSetting.packageVersion}】", OnBuildPipeline);
|
||||
onUpdateBuildPipelineEntity =
|
||||
new BuildAssetEntity("更新", $"更新至服务器【版本:{BuildAssetDataSetting.packageVersion}】", OnUpdateBuildPipeline);
|
||||
|
||||
}
|
||||
|
||||
private Vector2 scroll;
|
||||
@@ -240,7 +249,7 @@ namespace Stary.Evo.Editor
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成服务器路径
|
||||
/// </summary>
|
||||
@@ -250,6 +259,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateServerPath =
|
||||
$"Z:/{Application.productName}/{BuildAssetDataSetting.packageName}/{EditorUserBuildSettings.activeBuildTarget}/{BuildAssetDataSetting.packageVersion}";
|
||||
if (!Directory.Exists(updateServerPath))
|
||||
@@ -263,9 +273,9 @@ namespace Stary.Evo.Editor
|
||||
private void CreatePackageVersionJson()
|
||||
{
|
||||
string mainResDomainPath = $"Assets/Domain/{selectedPackageNames}/Conf/HotfixMainResDomain.asset";
|
||||
HotfixMainResDomain mainResDomain =
|
||||
HotfixMainResDomain mainResDomain =
|
||||
AssetDatabase.LoadAssetAtPath<HotfixMainResDomain>(mainResDomainPath);
|
||||
|
||||
|
||||
if (mainResDomain != null)
|
||||
{
|
||||
mainResDomain.hotfixMainResDomainEntity.packageVersion = BuildAssetDataSetting.packageVersion;
|
||||
@@ -277,7 +287,8 @@ namespace Stary.Evo.Editor
|
||||
EditorUtility.SetDirty(mainResDomain);
|
||||
// 保存更改
|
||||
AssetDatabase.SaveAssets();
|
||||
string serverPath = $"Z:/HybridclrConfigData/{BuildAssetDataSetting.packageName}/{EditorUserBuildSettings.activeBuildTarget}/";
|
||||
string serverPath =
|
||||
$"Z:/HybridclrConfigData/{BuildAssetDataSetting.packageName}/{EditorUserBuildSettings.activeBuildTarget}/";
|
||||
//直接保存服务器路径下,本地不保存
|
||||
EditorFrameworkUtils.SaveJson(mainResDomain.hotfixMainResDomainEntity, serverPath, Application.productName);
|
||||
}
|
||||
|
||||
@@ -31,26 +31,26 @@ namespace Stary.Evo.Editor
|
||||
[HideIf("@ dataSetting.selectedBuildPipelines==EBuildPipeline.EditorSimulateBuildPipeline")]
|
||||
public bool useAssetDependencyDBToggle;
|
||||
|
||||
[Title("资源包的压缩方式", titleAlignment: TitleAlignments.Centered)]
|
||||
[HorizontalGroup("FileStyle"), HideLabel]
|
||||
[OnValueChanged("SetCompression")]
|
||||
[ShowIf("@ dataSetting.selectedBuildPipelines==EBuildPipeline.BuiltinBuildPipeline")]
|
||||
public ECompressOption compression;
|
||||
// [Title("资源包的压缩方式", titleAlignment: TitleAlignments.Centered)]
|
||||
// [HorizontalGroup("FileStyle"), HideLabel]
|
||||
// [OnValueChanged("SetCompression")]
|
||||
// [ShowIf("@ dataSetting.selectedBuildPipelines==EBuildPipeline.BuiltinBuildPipeline")]
|
||||
private ECompressOption compression = ECompressOption.LZ4;
|
||||
|
||||
[Title("资源包文件名称样式", titleAlignment: TitleAlignments.Centered)]
|
||||
[HorizontalGroup("FileStyle"), HideLabel]
|
||||
[OnValueChanged("SetFileNameStyle")]
|
||||
[HideIf("@ dataSetting.selectedBuildPipelines==EBuildPipeline.EditorSimulateBuildPipeline")]
|
||||
public EFileNameStyle fileNameStyle;
|
||||
// [Title("资源包文件名称样式", titleAlignment: TitleAlignments.Centered)]
|
||||
// [HorizontalGroup("FileStyle"), HideLabel]
|
||||
// [OnValueChanged("SetFileNameStyle")]
|
||||
// [HideIf("@ dataSetting.selectedBuildPipelines==EBuildPipeline.EditorSimulateBuildPipeline")]
|
||||
private EFileNameStyle fileNameStyle = EFileNameStyle.BundleName;
|
||||
|
||||
[Title("首包资源文件的拷贝方式", titleAlignment: TitleAlignments.Centered)]
|
||||
[HorizontalGroup("FileStyle"), HideLabel]
|
||||
[VerticalGroup("BuildCache/FileStyle"), HideLabel]
|
||||
[InfoBox("资源拷贝方式,是否拷贝StreamingAssets")]
|
||||
[OnValueChanged("SetCopyBuildinFileOption")]
|
||||
[HideIf("@ dataSetting.selectedBuildPipelines==EBuildPipeline.EditorSimulateBuildPipeline")]
|
||||
public EBuildinFileCopyOption copyBuildinFileOption;
|
||||
|
||||
[Title("首包资源文件的拷贝参数", titleAlignment: TitleAlignments.Centered)]
|
||||
[HideLabel]
|
||||
|
||||
[VerticalGroup("BuildCache/FileStyle"), HideLabel]
|
||||
[OnValueChanged("SetCopyBuildinFileParams")]
|
||||
[ShowIf(
|
||||
"@copyBuildinFileOption==EBuildinFileCopyOption.ClearAndCopyByTags||copyBuildinFileOption==EBuildinFileCopyOption.OnlyCopyByTags ")]
|
||||
|
||||
@@ -325,11 +325,13 @@ namespace Stary.Evo.Editor
|
||||
AddressRuleName = nameof(AddressByFolderAndFileName),
|
||||
AssetTags = groupName,
|
||||
};
|
||||
//如果是video目录,设置
|
||||
if (groupName == "Video")
|
||||
{
|
||||
collector.PackRuleName = nameof(PackVideoFile);
|
||||
}
|
||||
|
||||
//TODO 暂时不设置
|
||||
// 如果是video目录,设置
|
||||
// if (groupName == "Video")
|
||||
// {
|
||||
// collector.PackRuleName = nameof(PackVideoFile);
|
||||
// }
|
||||
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(group, collector);
|
||||
Debug.Log("GetAssetAddress:" + GetAssetAddress(file));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.main",
|
||||
"version": "1.0.21",
|
||||
"version": "1.0.22",
|
||||
"displayName": "00.StaryEvo",
|
||||
"description": "This is an Framework package",
|
||||
"unity": "2021.3",
|
||||
|
||||
Reference in New Issue
Block a user