From feb8ed3206d10cdbb918ad141c1a298e5a18f22e Mon Sep 17 00:00:00 2001 From: walon Date: Tue, 6 Dec 2022 18:57:48 +0800 Subject: [PATCH] =?UTF-8?q?[opt]=20installer=E5=AE=89=E8=A3=85=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=90=8E=E4=BC=9A=E8=AE=B0=E5=BD=95=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E7=9A=84=E7=89=88=E6=9C=AC=EF=BC=8C=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Installer/InstallerController.cs | 39 ++++++++++++------------- Editor/Installer/InstallerWindow.cs | 20 +++++++++++-- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/Editor/Installer/InstallerController.cs b/Editor/Installer/InstallerController.cs index a596f85..da81bf1 100644 --- a/Editor/Installer/InstallerController.cs +++ b/Editor/Installer/InstallerController.cs @@ -124,6 +124,20 @@ namespace HybridCLR.Editor.Installer public string HybridclrLocalVersion => _hybridclrLocalVersion != null ? _hybridclrLocalVersion : _hybridclrLocalVersion = GetHybridCLRLocalVersion(); + + public string HybridCLRRepoInstalledVersion + { + get { return EditorPrefs.GetString("hybridclr_repo"); } + set { EditorPrefs.SetString("hybridclr_repo", value); } + } + + public string Il2CppRepoInstalledVersion + { + get { return EditorPrefs.GetString("il2cpp_plus_repo"); } + set { EditorPrefs.SetString("il2cpp_plus_repo", value); } + } + + private string GetHybridCLRLocalVersion() { string workDir = SettingsUtil.HybridCLRDataDir; @@ -226,15 +240,7 @@ namespace HybridCLR.Editor.Installer string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}"; { BashUtil.RemoveDir(hybridclrRepoDir); - string[] args = string.IsNullOrWhiteSpace(hybridclrVer) ? new string[] - { - "clone", - "--depth=1", - hybridclrRepoURL, - hybridclrRepoDir, - } - : - new string[] + string[] args = new string[] { "clone", "--depth=1", @@ -255,18 +261,7 @@ namespace HybridCLR.Editor.Installer string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}"; { BashUtil.RemoveDir(il2cppPlusRepoDir); - string[] args = string.IsNullOrWhiteSpace(il2cppPlusVer) ? - new string[] - { - "clone", - "--depth=1", - "-b", - $"{version.major}-main", - il2cppPlusRepoURL, - il2cppPlusRepoDir, - } - : - new string[] + string[] args = new string[] { "clone", "--depth=1", @@ -320,6 +315,8 @@ namespace HybridCLR.Editor.Installer Debug.Log("安装成功!"); _hybridclrLocalVersion = null; _il2cppPlusLocalVersion = null; + HybridCLRRepoInstalledVersion = hybridclrVer; + Il2CppRepoInstalledVersion = il2cppPlusVer; } else { diff --git a/Editor/Installer/InstallerWindow.cs b/Editor/Installer/InstallerWindow.cs index 8bec9e4..7f32445 100644 --- a/Editor/Installer/InstallerWindow.cs +++ b/Editor/Installer/InstallerWindow.cs @@ -16,8 +16,16 @@ namespace HybridCLR.Editor.Installer private void OnEnable() { _controller = new InstallerController(); - _hybridclrVersion = "1.0"; - _il2cppPlusVersion = $"{_controller.MajorVersion}-1.0"; + _hybridclrVersion = _controller.HybridCLRRepoInstalledVersion; + if (string.IsNullOrWhiteSpace(_hybridclrVersion)) + { + _hybridclrVersion = "1.0"; + } + _il2cppPlusVersion = _controller.Il2CppRepoInstalledVersion; + if (string.IsNullOrWhiteSpace(_il2cppPlusVersion)) + { + _il2cppPlusVersion = $"{_controller.MajorVersion}-1.0"; + } } private void OnGUI() @@ -90,6 +98,14 @@ namespace HybridCLR.Editor.Installer Debug.LogError($"il2cpp 版本不兼容,最小版本为 {_controller.GetCurrentUnityVersionMinCompatibleVersionStr()}"); return; } + if (string.IsNullOrWhiteSpace(_hybridclrVersion)) + { + _hybridclrVersion = "main"; + } + if (string.IsNullOrWhiteSpace(_il2cppPlusVersion)) + { + _il2cppPlusVersion = $"{_controller.MajorVersion}-main"; + } _controller.InstallLocalHybridCLR(_hybridclrVersion, _il2cppPlusVersion); } }