From 033edf402fe6c5f926736a276e105e67c821bd17 Mon Sep 17 00:00:00 2001 From: zhangzheng Date: Mon, 5 Jan 2026 12:24:17 +0800 Subject: [PATCH] 111 --- .../Editor/CreatDomainDirectory.cs | 11 +- .../Editor/EvoArtFolderCreator.cs | 2 +- Assets/00.ARMazTools/Editor/MarkAdressable.cs | 2 +- Assets/00.ARMazTools/package.json | 2 +- .../Editor/BuildAsset/BuildAssetWindow.cs | 106 +--------------- Assets/00.StaryEvoTools/Editor/Login.meta | 3 + .../Editor/Login/LoginAssetWindow.cs | 120 ++++++++++++++++++ .../Editor/Login/LoginAssetWindow.cs.meta | 3 + Assets/00.StaryEvoTools/package.json | 2 +- 9 files changed, 139 insertions(+), 112 deletions(-) create mode 100644 Assets/00.StaryEvoTools/Editor/Login.meta create mode 100644 Assets/00.StaryEvoTools/Editor/Login/LoginAssetWindow.cs create mode 100644 Assets/00.StaryEvoTools/Editor/Login/LoginAssetWindow.cs.meta diff --git a/Assets/00.ARMazTools/Editor/CreatDomainDirectory.cs b/Assets/00.ARMazTools/Editor/CreatDomainDirectory.cs index 807dc3c..5c3bdd0 100644 --- a/Assets/00.ARMazTools/Editor/CreatDomainDirectory.cs +++ b/Assets/00.ARMazTools/Editor/CreatDomainDirectory.cs @@ -16,15 +16,14 @@ public static class CreatDomainDirectory Debug.Log(" 自动运行 "); - if (!EditorPrefs.HasKey("StartUp")) + if (!EditorPrefs.HasKey("ARMaz_StartUp")) { // 通过标记记录是否已经执行过该方法 OnEditorStartUp(); - EditorPrefs.SetInt("StartUp", 1); - - if (EditorPrefs.GetInt("CreatDomainDirectory") == 0) + EditorPrefs.SetInt("ARMaz_StartUp", 1); + if (EditorPrefs.GetInt("ARMaz_CreatDomainDirectory") == 0) { - EditorPrefs.SetInt("CreatDomainDirectory", 1); + EditorPrefs.SetInt("ARMaz_CreatDomainDirectory", 1); bool isOk = EditorUtility.DisplayDialog("提示", "发现目录存在缺失,是否检索并创建缺失目录", "是", "否"); if (isOk) { @@ -44,7 +43,7 @@ public static class CreatDomainDirectory /// private static void OnEditorQuit() { - EditorPrefs.DeleteKey("StartUp"); + EditorPrefs.DeleteKey("ARMaz_StartUp"); } /// diff --git a/Assets/00.ARMazTools/Editor/EvoArtFolderCreator.cs b/Assets/00.ARMazTools/Editor/EvoArtFolderCreator.cs index 4b65ca2..60d513c 100644 --- a/Assets/00.ARMazTools/Editor/EvoArtFolderCreator.cs +++ b/Assets/00.ARMazTools/Editor/EvoArtFolderCreator.cs @@ -9,7 +9,7 @@ public class EvoArtFolderCreator : EditorWindow static string[] moduleNames; // 下拉列表 static int selectedIndex; // 当前选中的下标 - [MenuItem("Evo/创建Art文件夹")] + [MenuItem("Evo/ARMaz/创建Art文件夹")] static void OpenCreator() { var w = GetWindowWithRect(new Rect(0, 0, 350, 110), true, "创建点位"); diff --git a/Assets/00.ARMazTools/Editor/MarkAdressable.cs b/Assets/00.ARMazTools/Editor/MarkAdressable.cs index 0d8f055..703fea3 100644 --- a/Assets/00.ARMazTools/Editor/MarkAdressable.cs +++ b/Assets/00.ARMazTools/Editor/MarkAdressable.cs @@ -15,7 +15,7 @@ namespace Stary.Evo.Editor { get { return Application.dataPath + "/Modules"; } } - [MenuItem("Evo/Hotfix/一键标记所有模块")] + [MenuItem("Evo/ARMaz/一键标记所有模块")] /// /// 一键标记所有模块 /// diff --git a/Assets/00.ARMazTools/package.json b/Assets/00.ARMazTools/package.json index 3a6c32a..718f687 100644 --- a/Assets/00.ARMazTools/package.json +++ b/Assets/00.ARMazTools/package.json @@ -1,6 +1,6 @@ { "name": "com.staryevo.armaztools", - "version": "1.0.2", + "version": "1.0.3", "displayName": "00.StaryEvo.ARMazTools", "description": "This is an ARMazTools package(后台服务器版本,端口9527)", "unity": "2021.3", diff --git a/Assets/00.StaryEvoTools/Editor/BuildAsset/BuildAssetWindow.cs b/Assets/00.StaryEvoTools/Editor/BuildAsset/BuildAssetWindow.cs index af40268..1d39242 100644 --- a/Assets/00.StaryEvoTools/Editor/BuildAsset/BuildAssetWindow.cs +++ b/Assets/00.StaryEvoTools/Editor/BuildAsset/BuildAssetWindow.cs @@ -61,37 +61,8 @@ namespace Stary.Evo.Editor protected override async void Initialize() { base.Initialize(); - - //初始化读取资源配置表 - hotfixMainResDomain = Resources.Load("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() { diff --git a/Assets/00.StaryEvoTools/Editor/Login.meta b/Assets/00.StaryEvoTools/Editor/Login.meta new file mode 100644 index 0000000..e8af3a1 --- /dev/null +++ b/Assets/00.StaryEvoTools/Editor/Login.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5b14022c08bc4e74946366863a25acd2 +timeCreated: 1767584975 \ No newline at end of file diff --git a/Assets/00.StaryEvoTools/Editor/Login/LoginAssetWindow.cs b/Assets/00.StaryEvoTools/Editor/Login/LoginAssetWindow.cs new file mode 100644 index 0000000..7685f73 --- /dev/null +++ b/Assets/00.StaryEvoTools/Editor/Login/LoginAssetWindow.cs @@ -0,0 +1,120 @@ +using System; +using System.Threading.Tasks; +using Sirenix.OdinInspector; +using Sirenix.OdinInspector.Editor; +using Stary.Evo.Editor; +using UnityEditor; +using UnityEngine; + +namespace Stary.Evo +{ + [InitializeOnLoad] + public class LoginAssetWindow : OdinEditorWindow + { + [MenuItem("Evo/登录", false, 3)] + static void Init() + { + var window = (LoginAssetWindow)EditorWindow.GetWindow(typeof(LoginAssetWindow)); + window.Show(); + } + + [ShowIf("IsLogin")] [BoxGroup("Login", showLabel: false)] [OnValueChanged("SetWebRequestInfo")] + public string ip, userName, password; + + private HotfixMainResDomain hotfixMainResDomain; + + private BuildAssetType buildAssetType; + + private string message; + + protected override async void Initialize() + { + base.Initialize(); + + //初始化读取资源配置表 + hotfixMainResDomain = Resources.Load("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; + } + + + bool isValidateToken = await WebRequestSystem.GetValidateToken(ip + "/Authentication/validateToken"); + if (isValidateToken) + { + buildAssetType = BuildAssetType.Build; + message = "已登录"; + return; + } + + buildAssetType = BuildAssetType.Login; + message = "未登录"; + } + + [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)); + } + + if (islogin) + { + buildAssetType = BuildAssetType.Build; + message = "已登录"; + } + else + { + buildAssetType = BuildAssetType.Login; + message = "未登录"; + } + + EditorUtility.ClearProgressBar(); + } + + [HideIf("IsLogin")] + [Button("退出登录", ButtonSizes.Large)] + [InfoBox("@ message", InfoMessageType.Info)] + public void ExitLoginButton() + { + buildAssetType = BuildAssetType.Login; + message = "未登录"; + EditorPrefs.DeleteKey("Authorization"); + } + + 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 bool IsLogin() + { + return buildAssetType == BuildAssetType.Login; + } + } +} \ No newline at end of file diff --git a/Assets/00.StaryEvoTools/Editor/Login/LoginAssetWindow.cs.meta b/Assets/00.StaryEvoTools/Editor/Login/LoginAssetWindow.cs.meta new file mode 100644 index 0000000..204db03 --- /dev/null +++ b/Assets/00.StaryEvoTools/Editor/Login/LoginAssetWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9dd448da967d40e7859a0f9397f8395a +timeCreated: 1767584994 \ No newline at end of file diff --git a/Assets/00.StaryEvoTools/package.json b/Assets/00.StaryEvoTools/package.json index 158d7e0..830bcb6 100644 --- a/Assets/00.StaryEvoTools/package.json +++ b/Assets/00.StaryEvoTools/package.json @@ -1,6 +1,6 @@ { "name": "com.staryevo.tools", - "version": "1.2.16", + "version": "1.2.17", "displayName": "00.StaryEvo.Tools", "description": "This is an Framework package(后台服务器版本,端口9527)", "unity": "2021.3",