[change] 对于小版本不兼容的Unity版本,不再禁止安装,而是提示警告

main
walon 2023-09-17 23:30:09 +08:00
parent 260909bd4b
commit 61fb0cfe34
2 changed files with 19 additions and 6 deletions

View File

@ -123,18 +123,25 @@ namespace HybridCLR.Editor.Installer
}
}
public bool IsCompatibleVersion()
public enum CompatibleType
{
Compatible,
MaybeIncompatible,
Incompatible,
}
public CompatibleType GetCompatibleType()
{
UnityVersion version = _curVersion;
if (version == null)
{
return false;
return CompatibleType.Incompatible;
}
if (version.minor1 != 3)
{
return false;
return CompatibleType.MaybeIncompatible;
}
return true;
return CompatibleType.Compatible;
}
public string HybridclrLocalVersion => _curDefaultVersion?.hybridclr?.branch;
@ -202,7 +209,7 @@ namespace HybridCLR.Editor.Installer
private void RunInitLocalIl2CppData(string editorIl2cppPath, string libil2cppWithHybridclrSourceDir, UnityVersion version)
{
if (!IsCompatibleVersion())
if (GetCompatibleType() == CompatibleType.Incompatible)
{
Debug.LogError($"Incompatible with current version, minimum compatible version: {GetCurrentUnityVersionMinCompatibleVersionStr()}");
return;

View File

@ -49,8 +49,14 @@ namespace HybridCLR.Editor.Installer
GUILayout.Space(10f);
if (_controller.IsCompatibleVersion())
InstallerController.CompatibleType compatibleType = _controller.GetCompatibleType();
if (compatibleType != InstallerController.CompatibleType.Incompatible)
{
if (compatibleType == InstallerController.CompatibleType.MaybeIncompatible)
{
EditorGUILayout.HelpBox($"Maybe incompatible with current version, recommend minimum compatible version:{_controller.GetCurrentUnityVersionMinCompatibleVersionStr()}", MessageType.Warning);
}
EditorGUILayout.BeginHorizontal();
_installFromDir = EditorGUILayout.Toggle("Copy libil2cpp from local", _installFromDir, GUILayout.MinWidth(100));
EditorGUI.BeginDisabledGroup(!_installFromDir);