[new] Installer界面新增显示package版本
parent
c8cd323bb0
commit
0a82b0d339
|
@ -24,11 +24,14 @@ namespace HybridCLR.Editor.Installer
|
|||
private readonly HybridclrVersionManifest _versionManifest;
|
||||
private readonly HybridclrVersionInfo _curDefaultVersion;
|
||||
|
||||
public string PackageVersion { get; private set; }
|
||||
|
||||
public InstallerController()
|
||||
{
|
||||
_curVersion = ParseUnityVersion(Application.unityVersion);
|
||||
_versionManifest = GetHybridCLRVersionManifest();
|
||||
_curDefaultVersion = _versionManifest.versions.FirstOrDefault(v => v.unity_version == _curVersion.major.ToString());
|
||||
PackageVersion = LoadPackageInfo().version;
|
||||
}
|
||||
|
||||
private HybridclrVersionManifest GetHybridCLRVersionManifest()
|
||||
|
@ -37,6 +40,21 @@ namespace HybridCLR.Editor.Installer
|
|||
return JsonUtility.FromJson<HybridclrVersionManifest>(File.ReadAllText(versionFile, Encoding.UTF8));
|
||||
}
|
||||
|
||||
private PackageInfo LoadPackageInfo()
|
||||
{
|
||||
string packageJson = $"{SettingsUtil.ProjectDir}/Packages/{SettingsUtil.PackageName}/package.json";
|
||||
return JsonUtility.FromJson<PackageInfo>(File.ReadAllText(packageJson, Encoding.UTF8));
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
class PackageInfo
|
||||
{
|
||||
public string name;
|
||||
|
||||
public string version;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
class VersionDesc
|
||||
{
|
||||
|
|
|
@ -44,7 +44,10 @@ namespace HybridCLR.Editor.Installer
|
|||
EditorGUILayout.LabelField($"安装状态:{(hasInstall ? "已安装" : "未安装")}", EditorStyles.boldLabel);
|
||||
GUILayout.Space(10f);
|
||||
|
||||
EditorGUILayout.LabelField($"HybridCLR 版本: {_controller.HybridclrLocalVersion}");
|
||||
|
||||
EditorGUILayout.LabelField($"{SettingsUtil.PackageName} 版本: v{_controller.PackageVersion}");
|
||||
GUILayout.Space(5f);
|
||||
EditorGUILayout.LabelField($"bybridclr 版本: {_controller.HybridclrLocalVersion}");
|
||||
GUILayout.Space(5f);
|
||||
EditorGUILayout.LabelField($"il2cpp_plus 版本: {_controller.Il2cppPlusLocalVersion}");
|
||||
GUILayout.Space(5f);
|
||||
|
|
Loading…
Reference in New Issue