This commit is contained in:
zhangzheng
2026-01-05 12:24:17 +08:00
parent 2d23b1e12f
commit 033edf402f
9 changed files with 139 additions and 112 deletions

View File

@@ -61,37 +61,8 @@ namespace Stary.Evo.Editor
protected override async void Initialize()
{
base.Initialize();
//初始化读取资源配置表
hotfixMainResDomain = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
if (hotfixMainResDomain == null)
{
Debug.LogError($"UnityEvo:读取资源配置表失败【HotfixMainResDomain】...表在Resources下不存在请创建");
}
else
{
ip = hotfixMainResDomain.hotfixMainResDomainEntity.ipconfig;
EditorPrefs.SetString("ip", ip);
userName = hotfixMainResDomain.hotfixMainResDomainEntity.username;
password = hotfixMainResDomain.hotfixMainResDomainEntity.password;
}
GetBuildPackageNames();
if (string.IsNullOrEmpty(ip))
{
buildAssetType = BuildAssetType.Login;
return;
}
bool isValidateToken = await WebRequestSystem.GetValidateToken(ip + "/Authentication/validateToken");
if (isValidateToken)
{
buildAssetType = BuildAssetType.Build;
return;
}
buildAssetType = BuildAssetType.Login;
}
public static void RemoveBuildAssetWindow()
@@ -99,62 +70,7 @@ namespace Stary.Evo.Editor
if (window != null)
window.Close();
}
[EnumToggleButtons, HideLabel] public BuildAssetType buildAssetType;
#region BuildAssetLogin
[ShowIf("IsLogin")] [BoxGroup("Login", showLabel: false)] [OnValueChanged("SetWebRequestInfo")]
public string ip, userName, password;
[ShowIf("IsLogin")]
[BoxGroup("Login", showLabel: false)]
[Button("登录", ButtonSizes.Large)]
[InfoBox("@ message", InfoMessageType.Info)]
public async void LoginButton()
{
string url = ip + "/Authentication/login";
EditorUtility.DisplayProgressBar("提示", $"登陆中~", 0f);
bool islogin = await WebRequestSystem.Login(url, userName, password);
float progress = 0f;
while (progress >= 1f)
{
progress += 0.1f;
EditorUtility.DisplayProgressBar("提示", $"登陆中~", progress);
await Task.Delay(TimeSpan.FromSeconds(0.2f));
}
EditorUtility.ClearProgressBar();
UpdateMessage(islogin);
}
private void SetWebRequestInfo()
{
if (hotfixMainResDomain != null)
{
hotfixMainResDomain.hotfixMainResDomainEntity.ipconfig = ip;
hotfixMainResDomain.hotfixMainResDomainEntity.username = userName;
hotfixMainResDomain.hotfixMainResDomainEntity.password = password;
EditorPrefs.SetString("ip", ip);
EditorUtility.SetDirty(hotfixMainResDomain);
AssetDatabase.SaveAssets();
}
}
private string message;
public void UpdateMessage(bool islogin)
{
message = "当前登录状态为:" + islogin;
if (islogin)
{
buildAssetType = BuildAssetType.Build;
}
}
#endregion
protected void OnSelectionChange()
{
EditorUtility.SetDirty(BuildAssetDataSetting);
@@ -163,7 +79,6 @@ namespace Stary.Evo.Editor
}
[BoxGroup("Build", showLabel: false)]
[ShowIf("IsBuild")]
[Title("包裹列表", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("Build/BuildPipeline"), HideLabel]
[ValueDropdown("GetBuildPackageNames")]
@@ -171,7 +86,6 @@ namespace Stary.Evo.Editor
public string selectedPackageNames;
[BoxGroup("Build", showLabel: false)]
[ShowIf("IsBuild")]
[Title("当前打包平台", titleAlignment: TitleAlignments.Centered)]
[ReadOnly]
[HorizontalGroup("Build/BuildPipeline"), HideLabel]
@@ -182,7 +96,6 @@ namespace Stary.Evo.Editor
#region HyBridCLRBuild
[BoxGroup("Build", showLabel: false)]
[HideIf("@ buildAssetType!= Stary.Evo.BuildAssetType.Build")]
[Title("打包dll(子包仅打一次)", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("Build/HyBridClrBuildEntity"), HideLabel]
public BuildAssetEntity hyBridClrBuildEntity =
@@ -200,7 +113,6 @@ namespace Stary.Evo.Editor
#region MarkAsset
[BoxGroup("Build", showLabel: false)]
[ShowIf("IsBuild")]
[Title("标记资源", titleAlignment: TitleAlignments.Centered)]
[HorizontalGroup("Build/HyBridClrBuildEntity"), HideLabel]
public BuildAssetEntity markAssetEntity =
@@ -211,7 +123,6 @@ namespace Stary.Evo.Editor
#region BuildAsset
[BoxGroup("Build", showLabel: false)]
[ShowIf("IsBuild")]
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)]
[HideLabel]
public BuildAssetDataSetting BuildAssetDataSetting;
@@ -292,7 +203,6 @@ namespace Stary.Evo.Editor
#region Update
[BoxGroup("Build", showLabel: false)]
[ShowIf("IsBuild")]
[Title("打包本地资源", titleAlignment: TitleAlignments.Centered)]
[HideLabel]
public BuildAssetEntity onBuildPipelineEntity;
@@ -300,7 +210,7 @@ namespace Stary.Evo.Editor
[BoxGroup("Build", showLabel: false)]
[Title("上传资源", titleAlignment: TitleAlignments.Centered)]
[HideLabel]
[ShowIf("@ IsRelease() && IsBuild()")]
[ShowIf("IsRelease")]
public BuildAssetEntity onUpdateBuildPipelineEntity;
@@ -491,7 +401,7 @@ namespace Stary.Evo.Editor
DomainName = selectedPackageNames,
Platform = EditorUserBuildSettings.activeBuildTarget.ToString(),
};
var resResultMessage = await WebRequestSystem.Post(ip + "/ResDomain/GetResDomainByDomain",
var resResultMessage = await WebRequestSystem.Post(EditorPrefs.GetString("ip") + "/ResDomain/GetResDomainByDomain",
JsonConvert.SerializeObject(resDmainAddRequst));
//如果低于服务器版本,更新版本号
if (resResultMessage.code != 1011)
@@ -555,15 +465,7 @@ namespace Stary.Evo.Editor
onUpdateBuildPipelineEntity.SetButtonName($"更新至服务器【版本:{BuildAssetDataSetting.packageVersion}】");
}
private bool IsLogin()
{
return buildAssetType == BuildAssetType.Login;
}
private bool IsBuild()
{
return buildAssetType == BuildAssetType.Build;
}
private bool IsRelease()
{