打开获取版本

This commit is contained in:
2025-06-12 12:03:00 +08:00
parent b6cd011714
commit d60d2ed5c3
5 changed files with 51 additions and 10 deletions

View File

@@ -132,24 +132,28 @@ namespace Stary.Evo.Editor
public string GetBuildPackageVersion(bool isUpdate = false) public string GetBuildPackageVersion(bool isUpdate = false)
{ {
string version = "";
if (environmentType == EnvironmentType.Debug) if (environmentType == EnvironmentType.Debug)
{ {
return "Simulate"; EditorUtility.SetDirty(this);
AssetDatabase.SaveAssets();
version= "Simulate";
} }
if (environmentType == EnvironmentType.Release) if (environmentType == EnvironmentType.Release)
{ {
string version = version =
$"{packageVersionX}.{packageVersionY}.{packageVersionZ}"; $"{packageVersionX}.{packageVersionY}.{packageVersionZ}";
if (isUpdate) if (isUpdate)
packageVersionZ++; packageVersionZ++;
packageVersion = $"{packageVersionX}.{packageVersionY}.{packageVersionZ}"; packageVersion = $"{packageVersionX}.{packageVersionY}.{packageVersionZ}";
return version;
}
return null; }
EditorUtility.SetDirty(this);
AssetDatabase.SaveAssets();
return version;
} }
public void GetPackageVersion() public void GetPackageVersion()

View File

@@ -236,6 +236,8 @@ namespace Stary.Evo.Editor
{ {
Debug.LogError($"UnityEvo:BuildAssetDataSetting 不存在,请检查路径{buildAssetDataSettingPath}"); Debug.LogError($"UnityEvo:BuildAssetDataSetting 不存在,请检查路径{buildAssetDataSettingPath}");
} }
GetHostBuildPackageVersion(buildAssetDataSetting);
} }
/// <summary> /// <summary>
@@ -384,7 +386,7 @@ namespace Stary.Evo.Editor
string fileId = data["id"].ToString(); string fileId = data["id"].ToString();
ResDmainAddRequst resDmainAddRequst = new ResDmainAddRequst() ResDmainAddRequst resDmainAddRequst = new ResDmainAddRequst()
{ {
ProductName = Application.productName, ProductName = Application.identifier,
DomainName = setting.packageName, DomainName = setting.packageName,
Platform = EditorUserBuildSettings.activeBuildTarget.ToString(), Platform = EditorUserBuildSettings.activeBuildTarget.ToString(),
PackageVersion = setting.packageVersion, PackageVersion = setting.packageVersion,
@@ -421,7 +423,43 @@ namespace Stary.Evo.Editor
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
return; return;
} }
/// <summary>
/// 获取服务器上版本号
/// </summary>
private async void GetHostBuildPackageVersion(BuildAssetDataSetting setting)
{
var resDmainAddRequst = new ResDmainRequst()
{
ProductName = Application.identifier,
DomainName = selectedPackageNames,
Platform = EditorUserBuildSettings.activeBuildTarget.ToString(),
};
var resResultMessage = await WebRequestSystem.Post(ip + "/ResDomain/GetResDomainByDomain",
JsonConvert.SerializeObject(resDmainAddRequst));
//如果低于服务器版本,更新版本号
if (resResultMessage.code != 1011)
{
ResDmainResponse domainResponse =
JsonConvert.DeserializeObject<ResDmainResponse>(resResultMessage.data
.ToString());
string[] versions = domainResponse.PackageVersion.Split('.');
setting.packageVersionX = int.Parse(versions[0]);
setting.packageVersionY = int.Parse(versions[1]);
setting.packageVersionZ = int.Parse(versions[2]);
setting.GetBuildPackageVersion(true);
}
else
{
EditorUtility.DisplayDialog("提示",
$"{resResultMessage.message},默认1.0.0版本 ", "确定");
setting.packageVersionX = 1;
setting.packageVersionY = 0;
setting.packageVersionZ = 0;
setting.GetBuildPackageVersion(false);
}
}
#endregion #endregion
protected void Init() protected void Init()

View File

@@ -71,7 +71,7 @@ namespace Stary.Evo.Editor
string url = $"{ip}/ResDomain/GetResDomainByDomain"; string url = $"{ip}/ResDomain/GetResDomainByDomain";
var resDmainRequst = new ResDmainRequst() var resDmainRequst = new ResDmainRequst()
{ {
ProductName = Application.productName, ProductName = Application.identifier,
DomainName = oneKeyBUildEntity.DomainName, DomainName = oneKeyBUildEntity.DomainName,
Platform = UnityEditor.EditorUserBuildSettings.activeBuildTarget.ToString(), Platform = UnityEditor.EditorUserBuildSettings.activeBuildTarget.ToString(),
}; };

View File

@@ -18,6 +18,5 @@ namespace Stary.Evo
public string mainDomainVersion =""; public string mainDomainVersion ="";
public string username="UnityHot"; public string username="UnityHot";
public string password="Unity1234"; public string password="Unity1234";
public string productName="UnityEvo";
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "com.staryevo.main", "name": "com.staryevo.main",
"version": "1.2.11", "version": "1.2.12",
"displayName": "00.StaryEvo", "displayName": "00.StaryEvo",
"description": "This is an Framework package(后台服务器版本端口9527)", "description": "This is an Framework package(后台服务器版本端口9527)",
"unity": "2021.3", "unity": "2021.3",