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

@@ -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
/// </summary>
private static void OnEditorQuit()
{
EditorPrefs.DeleteKey("StartUp");
EditorPrefs.DeleteKey("ARMaz_StartUp");
}
/// <summary>

View File

@@ -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<EvoArtFolderCreator>(new Rect(0, 0, 350, 110), true, "创建点位");

View File

@@ -15,7 +15,7 @@ namespace Stary.Evo.Editor
{
get { return Application.dataPath + "/Modules"; }
}
[MenuItem("Evo/Hotfix/一键标记所有模块")]
[MenuItem("Evo/ARMaz/一键标记所有模块")]
/// <summary>
/// 一键标记所有模块
/// </summary>

View File

@@ -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",

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()
{

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5b14022c08bc4e74946366863a25acd2
timeCreated: 1767584975

View File

@@ -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>("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;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9dd448da967d40e7859a0f9397f8395a
timeCreated: 1767584994

View File

@@ -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",