[opt] installer安装成功后会记录 安装的版本,并且显示。

walon 2022-12-06 18:57:48 +08:00
parent 6939d16b6c
commit feb8ed3206
2 changed files with 36 additions and 23 deletions

View File

@ -124,6 +124,20 @@ namespace HybridCLR.Editor.Installer
public string HybridclrLocalVersion => _hybridclrLocalVersion != null ? _hybridclrLocalVersion : _hybridclrLocalVersion = GetHybridCLRLocalVersion(); 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() private string GetHybridCLRLocalVersion()
{ {
string workDir = SettingsUtil.HybridCLRDataDir; string workDir = SettingsUtil.HybridCLRDataDir;
@ -226,15 +240,7 @@ namespace HybridCLR.Editor.Installer
string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}"; string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}";
{ {
BashUtil.RemoveDir(hybridclrRepoDir); BashUtil.RemoveDir(hybridclrRepoDir);
string[] args = string.IsNullOrWhiteSpace(hybridclrVer) ? new string[] string[] args = new string[]
{
"clone",
"--depth=1",
hybridclrRepoURL,
hybridclrRepoDir,
}
:
new string[]
{ {
"clone", "clone",
"--depth=1", "--depth=1",
@ -255,18 +261,7 @@ namespace HybridCLR.Editor.Installer
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}"; string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
{ {
BashUtil.RemoveDir(il2cppPlusRepoDir); BashUtil.RemoveDir(il2cppPlusRepoDir);
string[] args = string.IsNullOrWhiteSpace(il2cppPlusVer) ? string[] args = new string[]
new string[]
{
"clone",
"--depth=1",
"-b",
$"{version.major}-main",
il2cppPlusRepoURL,
il2cppPlusRepoDir,
}
:
new string[]
{ {
"clone", "clone",
"--depth=1", "--depth=1",
@ -320,6 +315,8 @@ namespace HybridCLR.Editor.Installer
Debug.Log("安装成功!"); Debug.Log("安装成功!");
_hybridclrLocalVersion = null; _hybridclrLocalVersion = null;
_il2cppPlusLocalVersion = null; _il2cppPlusLocalVersion = null;
HybridCLRRepoInstalledVersion = hybridclrVer;
Il2CppRepoInstalledVersion = il2cppPlusVer;
} }
else else
{ {

View File

@ -16,8 +16,16 @@ namespace HybridCLR.Editor.Installer
private void OnEnable() private void OnEnable()
{ {
_controller = new InstallerController(); _controller = new InstallerController();
_hybridclrVersion = "1.0"; _hybridclrVersion = _controller.HybridCLRRepoInstalledVersion;
_il2cppPlusVersion = $"{_controller.MajorVersion}-1.0"; if (string.IsNullOrWhiteSpace(_hybridclrVersion))
{
_hybridclrVersion = "1.0";
}
_il2cppPlusVersion = _controller.Il2CppRepoInstalledVersion;
if (string.IsNullOrWhiteSpace(_il2cppPlusVersion))
{
_il2cppPlusVersion = $"{_controller.MajorVersion}-1.0";
}
} }
private void OnGUI() private void OnGUI()
@ -90,6 +98,14 @@ namespace HybridCLR.Editor.Installer
Debug.LogError($"il2cpp 版本不兼容,最小版本为 {_controller.GetCurrentUnityVersionMinCompatibleVersionStr()}"); Debug.LogError($"il2cpp 版本不兼容,最小版本为 {_controller.GetCurrentUnityVersionMinCompatibleVersionStr()}");
return; return;
} }
if (string.IsNullOrWhiteSpace(_hybridclrVersion))
{
_hybridclrVersion = "main";
}
if (string.IsNullOrWhiteSpace(_il2cppPlusVersion))
{
_il2cppPlusVersion = $"{_controller.MajorVersion}-main";
}
_controller.InstallLocalHybridCLR(_hybridclrVersion, _il2cppPlusVersion); _controller.InstallLocalHybridCLR(_hybridclrVersion, _il2cppPlusVersion);
} }
} }