111
This commit is contained in:
@@ -44,37 +44,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 = Stary.Evo.BuildOriginality.BuildAssetType.Login;
|
||||
return;
|
||||
}
|
||||
|
||||
bool isValidateToken = await WebRequestSystem.GetValidateToken(ip + "/Authentication/validateToken");
|
||||
if (isValidateToken)
|
||||
{
|
||||
buildAssetType = Stary.Evo.BuildOriginality.BuildAssetType.Build;
|
||||
}
|
||||
else
|
||||
{
|
||||
buildAssetType = Stary.Evo.BuildOriginality.BuildAssetType.Login;
|
||||
}
|
||||
|
||||
|
||||
//初始化打包管线
|
||||
_buildPipelineViewer = new ScriptableBuildPipelineViewer(packageName,
|
||||
@@ -91,69 +62,7 @@ namespace Stary.Evo.Editor
|
||||
window.Close();
|
||||
}
|
||||
|
||||
[EnumToggleButtons, HideLabel] public Stary.Evo.BuildOriginality.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 = Stary.Evo.BuildOriginality.BuildAssetType.Build;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void OnSelectionChange()
|
||||
{
|
||||
// EditorUtility.SetDirty(BuildAssetDataSetting);
|
||||
// AssetDatabase.SaveAssets();
|
||||
//AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
[ShowIf("IsBuild")]
|
||||
[Title("包裹列表", titleAlignment: TitleAlignments.Centered)]
|
||||
[HorizontalGroup("Build/BuildPipeline"), HideLabel]
|
||||
[ValueDropdown("GetBuildPackageNames")]
|
||||
@@ -161,7 +70,6 @@ namespace Stary.Evo.Editor
|
||||
public string selectedPackageNames;
|
||||
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
[ShowIf("IsBuild")]
|
||||
[Title("当前打包平台", titleAlignment: TitleAlignments.Centered)]
|
||||
[ReadOnly]
|
||||
[HorizontalGroup("Build/BuildPipeline"), HideLabel]
|
||||
@@ -172,7 +80,6 @@ namespace Stary.Evo.Editor
|
||||
|
||||
[Title("版本号", titleAlignment: TitleAlignments.Centered)]
|
||||
[HorizontalGroup("Build/PackageVersion"), HideLabel]
|
||||
[ShowIf("IsBuild")]
|
||||
[OnValueChanged("OnPackageValueChanged")]
|
||||
public string _packageVersion;
|
||||
|
||||
@@ -257,13 +164,11 @@ namespace Stary.Evo.Editor
|
||||
#region Update
|
||||
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
[ShowIf("IsBuild")]
|
||||
[Title("打包本地资源", titleAlignment: TitleAlignments.Centered)]
|
||||
[HideLabel]
|
||||
public BuildAssetEntity onBuildPipelineEntity;
|
||||
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
[ShowIf("IsBuild")]
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
[Title("上传资源", titleAlignment: TitleAlignments.Centered)]
|
||||
[HideLabel]
|
||||
public BuildAssetEntity onUpdateBuildPipelineEntity;
|
||||
@@ -385,15 +290,7 @@ namespace Stary.Evo.Editor
|
||||
|
||||
public async Task UpdateFileDataResDomain(string zipFilePath)
|
||||
{
|
||||
//初始化读取资源配置表
|
||||
HotfixMainResDomain hotfixMainResDomain = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
|
||||
if (hotfixMainResDomain == null)
|
||||
{
|
||||
Debug.LogError($"UnityEvo:读取资源配置表失败【HotfixMainResDomain】...表不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
var ip = hotfixMainResDomain.hotfixMainResDomainEntity.ipconfig;
|
||||
string ip = EditorPrefs.GetString("ip");
|
||||
var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", new[] { zipFilePath });
|
||||
EditorUtility.DisplayProgressBar("提示", $"开始上传{packageName}(上传zip文件)", 0.5f);
|
||||
if (messageEntity.code == 200)
|
||||
@@ -466,6 +363,7 @@ namespace Stary.Evo.Editor
|
||||
DomainName = selectedPackageNames,
|
||||
Platform = EditorUserBuildSettings.activeBuildTarget.ToString(),
|
||||
};
|
||||
string ip = EditorPrefs.GetString("ip");
|
||||
var resResultMessage = await WebRequestSystem.Post(ip + "/ResDomain/GetResDomainByDomain",
|
||||
JsonConvert.SerializeObject(resDmainAddRequst));
|
||||
//如果低于服务器版本,更新版本号
|
||||
@@ -521,15 +419,5 @@ namespace Stary.Evo.Editor
|
||||
onBuildPipelineEntity.SetButtonName($"打包资源包【版本:{_packageVersion}】");
|
||||
onUpdateBuildPipelineEntity.SetButtonName($"更新至服务器【版本:{_packageVersion}】");
|
||||
}
|
||||
|
||||
private bool IsLogin()
|
||||
{
|
||||
return buildAssetType == Stary.Evo.BuildOriginality.BuildAssetType.Login;
|
||||
}
|
||||
|
||||
private bool IsBuild()
|
||||
{
|
||||
return buildAssetType == Stary.Evo.BuildOriginality.BuildAssetType.Build;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/00.BuildOriginality/Editor/Login.meta
Normal file
3
Assets/00.BuildOriginality/Editor/Login.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94e01ef683d94529bdd444c645a9ee92
|
||||
timeCreated: 1767608263
|
||||
121
Assets/00.BuildOriginality/Editor/Login/LoginAssetWindow.cs
Normal file
121
Assets/00.BuildOriginality/Editor/Login/LoginAssetWindow.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Sirenix.OdinInspector;
|
||||
using Sirenix.OdinInspector.Editor;
|
||||
using Stary.Evo.BuildOriginality;
|
||||
using Stary.Evo.Editor;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public class LoginAssetWindow : OdinEditorWindow
|
||||
{
|
||||
[MenuItem("Evo/登录", false, 0)]
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea17f9f199d043bc863ef6038b6f2b70
|
||||
timeCreated: 1767608263
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.buildoriginality",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.13",
|
||||
"displayName": "00.StaryEvo.BuildOriginality",
|
||||
"description": "美术打包工具",
|
||||
"unity": "2021.3",
|
||||
|
||||
@@ -330,15 +330,9 @@ namespace Stary.Evo.Editor
|
||||
|
||||
public static async Task UpdateFileDataResDomain(BuildAssetDataSetting setting, string zipFilePath)
|
||||
{
|
||||
//初始化读取资源配置表
|
||||
HotfixMainResDomain hotfixMainResDomain = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
|
||||
if (hotfixMainResDomain == null)
|
||||
{
|
||||
Debug.LogError($"UnityEvo:读取资源配置表失败【HotfixMainResDomain】...表不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var ip = hotfixMainResDomain.hotfixMainResDomainEntity.ipconfig;
|
||||
string ip = EditorPrefs.GetString("ip");
|
||||
var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", new[] { zipFilePath });
|
||||
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(上传zip文件)", 0.5f);
|
||||
if (messageEntity.code == 200)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.tools",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"displayName": "00.StaryEvo.Tools",
|
||||
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
||||
"unity": "2021.3",
|
||||
|
||||
Reference in New Issue
Block a user