[change] 当用不兼容版本打开Installer时不再抛出异常,而是显示“与当前版本不兼容”

main
walon 2023-06-12 13:30:32 +08:00
parent 1459992ec4
commit 7749b6448e
2 changed files with 14 additions and 15 deletions

View File

@ -6,6 +6,7 @@ using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
using System.Text.RegularExpressions;
using System.Linq;
namespace HybridCLR.Editor.Installer
{
@ -27,7 +28,7 @@ namespace HybridCLR.Editor.Installer
{
_curVersion = ParseUnityVersion(Application.unityVersion);
_versionManifest = GetHybridCLRVersionManifest();
_curDefaultVersion = _versionManifest.versions.Find(v => v.unity_version == _curVersion.major.ToString());
_curDefaultVersion = _versionManifest.versions.FirstOrDefault(v => v.unity_version == _curVersion.major.ToString());
}
private HybridclrVersionManifest GetHybridCLRVersionManifest()
@ -112,6 +113,10 @@ namespace HybridCLR.Editor.Installer
public bool IsComaptibleVersion()
{
UnityVersion version = _curVersion;
if (version == null)
{
return false;
}
if (version.minor1 != 3)
{
return false;

View File

@ -48,24 +48,18 @@ namespace HybridCLR.Editor.Installer
GUILayout.Space(5f);
EditorGUILayout.LabelField($"il2cpp_plus 版本: {_controller.Il2cppPlusLocalVersion}");
GUILayout.Space(5f);
//GUIInstallButton("检查更新", "检查", UpdateHybridCLR);
//GUILayout.Space(40f);
GUILayout.Space(10f);
if (_controller.IsComaptibleVersion())
{
GUIInstallButton("安装hybridclr+il2cpp_plus代码到本地目录", "安装");
}
else
{
EditorGUILayout.HelpBox("与当前版本不兼容", MessageType.Error);
}
//EditorGUILayout.BeginHorizontal();
//EditorGUILayout.LabelField("待安装的 hybridclr 仓库版本号(或branch或tag)(默认取最新版本):", GUILayout.MaxWidth(400));
//_hybridclrVersion = EditorGUILayout.TextField(_hybridclrVersion);
//EditorGUILayout.EndHorizontal();
//EditorGUILayout.BeginHorizontal();
//EditorGUILayout.LabelField($"待安装的 il2cpp_plus 仓库版本号(或branch或tag)(默认取{_controller.MajorVersion}-main分支最新版本):", GUILayout.MaxWidth(400));
//_il2cppPlusVersion = EditorGUILayout.TextField(_il2cppPlusVersion);
//EditorGUILayout.EndHorizontal();
GUIInstallButton("安装hybridclr+il2cpp_plus代码到本地目录", "安装");
EditorGUILayout.EndVertical();
}