This commit is contained in:
2025-11-04 16:26:50 +08:00
parent 6a73f11f18
commit d2bf1ada3b
13 changed files with 408 additions and 219 deletions

View File

@@ -31,7 +31,7 @@ namespace Stary.Evo.Editor
public static OdinEditorWindow window;
private HotfixMainResDomain hotfixMainResDomain;
[MenuItem("Evo/Dev/资源打包工具",false, 2)]
[MenuItem("Evo/Dev/资源打包工具", false, 2)]
static void ShowWindows()
{
#if NotUpdate
@@ -71,10 +71,11 @@ namespace Stary.Evo.Editor
else
{
ip = hotfixMainResDomain.hotfixMainResDomainEntity.ipconfig;
EditorPrefs.SetString("ip",ip);
EditorPrefs.SetString("ip", ip);
userName = hotfixMainResDomain.hotfixMainResDomainEntity.username;
password = hotfixMainResDomain.hotfixMainResDomainEntity.password;
}
GetBuildPackageNames();
if (string.IsNullOrEmpty(ip))
{
@@ -103,12 +104,10 @@ namespace Stary.Evo.Editor
#region BuildAssetLogin
[ShowIf("@ buildAssetType== Stary.Evo.BuildAssetType.Login")]
[BoxGroup("Login", showLabel: false)]
[OnValueChanged("SetWebRequestInfo")]
[ShowIf("IsLogin")] [BoxGroup("Login", showLabel: false)] [OnValueChanged("SetWebRequestInfo")]
public string ip, userName, password;
[ShowIf("@ buildAssetType== Stary.Evo.BuildAssetType.Login")]
[ShowIf("IsLogin")]
[BoxGroup("Login", showLabel: false)]
[Button("登录", ButtonSizes.Large)]
[InfoBox("@ message", InfoMessageType.Info)]
@@ -129,6 +128,8 @@ namespace Stary.Evo.Editor
UpdateMessage(islogin);
}
private void SetWebRequestInfo()
{
if (hotfixMainResDomain != null)
@@ -136,7 +137,7 @@ namespace Stary.Evo.Editor
hotfixMainResDomain.hotfixMainResDomainEntity.ipconfig = ip;
hotfixMainResDomain.hotfixMainResDomainEntity.username = userName;
hotfixMainResDomain.hotfixMainResDomainEntity.password = password;
EditorPrefs.SetString("ip",ip);
EditorPrefs.SetString("ip", ip);
EditorUtility.SetDirty(hotfixMainResDomain);
AssetDatabase.SaveAssets();
}
@@ -163,7 +164,7 @@ namespace Stary.Evo.Editor
}
[BoxGroup("Build", showLabel: false)]
[ShowIf("@ buildAssetType== Stary.Evo.BuildAssetType.Build")]
[ShowIf("IsBuild")]
[Title("包裹列表", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("Build/BuildPipeline"), HideLabel]
[ValueDropdown("GetBuildPackageNames")]
@@ -171,7 +172,7 @@ namespace Stary.Evo.Editor
public string selectedPackageNames;
[BoxGroup("Build", showLabel: false)]
[ShowIf("@ buildAssetType== Stary.Evo.BuildAssetType.Build")]
[ShowIf("IsBuild")]
[Title("当前打包平台", titleAlignment: TitleAlignments.Centered)]
[ReadOnly]
[HorizontalGroup("Build/BuildPipeline"), HideLabel]
@@ -200,7 +201,7 @@ namespace Stary.Evo.Editor
#region MarkAsset
[BoxGroup("Build", showLabel: false)]
[ShowIf("@ buildAssetType== Stary.Evo.BuildAssetType.Build")]
[ShowIf("IsBuild")]
[Title("标记资源", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("Build/HyBridClrBuildEntity"), HideLabel]
public BuildAssetEntity markAssetEntity =
@@ -211,7 +212,7 @@ namespace Stary.Evo.Editor
#region BuildAsset
[BoxGroup("Build", showLabel: false)]
[ShowIf("@ buildAssetType== Stary.Evo.BuildAssetType.Build")]
[ShowIf("IsBuild")]
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)]
[HideLabel]
public BuildAssetDataSetting BuildAssetDataSetting;
@@ -292,7 +293,7 @@ namespace Stary.Evo.Editor
#region Update
[BoxGroup("Build", showLabel: false)]
[ShowIf("@ buildAssetType== Stary.Evo.BuildAssetType.Build")]
[ShowIf("IsBuild")]
[Title("打包本地资源", titleAlignment: TitleAlignments.Centered)]
[HideLabel]
public BuildAssetEntity onBuildPipelineEntity;
@@ -300,8 +301,7 @@ namespace Stary.Evo.Editor
[BoxGroup("Build", showLabel: false)]
[Title("上传资源", titleAlignment: TitleAlignments.Centered)]
[HideLabel]
[ShowIf(
"@ BuildAssetDataSetting.environmentType== EnvironmentType.Release && buildAssetType== Stary.Evo.BuildAssetType.Build")]
[ShowIf("@ IsRelease() && IsBuild()")]
public BuildAssetEntity onUpdateBuildPipelineEntity;
@@ -405,7 +405,7 @@ namespace Stary.Evo.Editor
// 假设 BuildinCatalog 文件名为 BuildinCatalog.json
string sourcePath = Path.Combine(copyPackageDirectory, fileName); // 源文件路径
string destinationPath = Path.Combine(outFilePath, fileName); // 目标文件路径
string destinationPath = Path.Combine(outFilePath, fileName); // 目标文件路径
// 如果目标文件已存在,则覆盖
if (File.Exists(destinationPath))
@@ -415,7 +415,6 @@ namespace Stary.Evo.Editor
// 执行拷贝操作
File.Copy(sourcePath, destinationPath);
}
public static async Task UpdateFileDataResDomain(BuildAssetDataSetting setting, string zipFilePath)
@@ -556,8 +555,24 @@ namespace Stary.Evo.Editor
onBuildPipelineEntity.SetButtonName($"打包资源包【版本:{BuildAssetDataSetting.packageVersion}】");
onUpdateBuildPipelineEntity.SetButtonName($"更新至服务器【版本:{BuildAssetDataSetting.packageVersion}】");
}
private bool IsLogin()
{
return buildAssetType == BuildAssetType.Login;
}
private bool IsBuild()
{
return buildAssetType == BuildAssetType.Build;
}
private bool IsRelease()
{
return BuildAssetDataSetting.environmentType == EnvironmentType.Release;
}
private bool IsDebug()
{
return BuildAssetDataSetting.environmentType == EnvironmentType.Debug;
}
}
}