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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user