00 精简打包设置
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user