Skip to content

Commit

Permalink
[opt] installer安装成功后会记录 安装的版本,并且显示。
Browse files Browse the repository at this point in the history
  • Loading branch information
walon committed Dec 6, 2022
1 parent 6be8b26 commit 419c3a9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
39 changes: 18 additions & 21 deletions Editor/Installer/InstallerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ public bool IsComaptibleVersion()

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;
Expand Down Expand Up @@ -226,15 +240,7 @@ private void RunInitLocalIl2CppData(string editorIl2cppPath, UnityVersion versio
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",
Expand All @@ -255,18 +261,7 @@ private void RunInitLocalIl2CppData(string editorIl2cppPath, UnityVersion versio
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",
Expand Down Expand Up @@ -320,6 +315,8 @@ private void RunInitLocalIl2CppData(string editorIl2cppPath, UnityVersion versio
Debug.Log("安装成功!");
_hybridclrLocalVersion = null;
_il2cppPlusLocalVersion = null;
HybridCLRRepoInstalledVersion = hybridclrVer;
Il2CppRepoInstalledVersion = il2cppPlusVer;
}
else
{
Expand Down
22 changes: 20 additions & 2 deletions Editor/Installer/InstallerWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@ public class InstallerWindow : EditorWindow
{
private InstallerController _controller;

string _hybridclrVersion = "";
string _il2cppPlusVersion = "";
string _hybridclrVersion;
string _il2cppPlusVersion;

private void OnEnable()
{
_controller = new InstallerController();
_hybridclrVersion = _controller.HybridCLRRepoInstalledVersion;
if (string.IsNullOrWhiteSpace(_hybridclrVersion))
{
_hybridclrVersion = "main";
}
_il2cppPlusVersion = _controller.Il2CppRepoInstalledVersion;
if (string.IsNullOrWhiteSpace(_il2cppPlusVersion))
{
_il2cppPlusVersion = $"{_controller.MajorVersion}-main";
}
}

private void OnGUI()
Expand Down Expand Up @@ -88,6 +98,14 @@ private void InstallLocalHybridCLR()
Debug.LogError($"il2cpp 版本不兼容,最小版本为 {_controller.GetCurrentUnityVersionMinCompatibleVersionStr()}");
return;
}
if (string.IsNullOrWhiteSpace(_hybridclrVersion))
{
_hybridclrVersion = "main";
}
if (string.IsNullOrWhiteSpace(_il2cppPlusVersion))
{
_il2cppPlusVersion = $"{_controller.MajorVersion}-main";
}
_controller.InstallLocalHybridCLR(_hybridclrVersion, _il2cppPlusVersion);
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.focus-creative-games.hybridclr_unity",
"version": "1.1.7",
"version": "1.1.8",
"displayName": "HybridCLR",
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
"category": "Runtime",
Expand Down

0 comments on commit 419c3a9

Please sign in to comment.