psst
This commit is contained in:
@@ -1,21 +1,39 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public static class DependencyCheckInitializer
|
||||
namespace SplashEdit.EditorCode
|
||||
{
|
||||
static DependencyCheckInitializer()
|
||||
/// <summary>
|
||||
/// Automatically opens the SplashEdit Control Panel on the first editor
|
||||
/// session if the MIPS toolchain has not been installed yet.
|
||||
/// </summary>
|
||||
[InitializeOnLoad]
|
||||
public static class DependencyCheckInitializer
|
||||
{
|
||||
EditorApplication.update += OpenInstallerOnStart;
|
||||
}
|
||||
private const string SessionKey = "SplashEditOpenedThisSession";
|
||||
|
||||
private static void OpenInstallerOnStart()
|
||||
{
|
||||
EditorApplication.update -= OpenInstallerOnStart;
|
||||
if (!SessionState.GetBool("InstallerWindowOpened", false))
|
||||
static DependencyCheckInitializer()
|
||||
{
|
||||
InstallerWindow.ShowWindow();
|
||||
SessionState.SetBool("InstallerWindowOpened", true); // only once per session
|
||||
EditorApplication.update += OpenControlPanelOnStart;
|
||||
}
|
||||
|
||||
private static void OpenControlPanelOnStart()
|
||||
{
|
||||
EditorApplication.update -= OpenControlPanelOnStart;
|
||||
|
||||
if (SessionState.GetBool(SessionKey, false))
|
||||
return;
|
||||
|
||||
SessionState.SetBool(SessionKey, true);
|
||||
|
||||
// Only auto-open the Control Panel when the toolchain is missing
|
||||
bool toolchainReady = ToolchainChecker.IsToolAvailable("mips") ||
|
||||
ToolchainChecker.IsToolAvailable("mipsel-none-elf-gcc") ||
|
||||
ToolchainChecker.IsToolAvailable("mipsel-linux-gnu-gcc");
|
||||
|
||||
if (!toolchainReady)
|
||||
{
|
||||
SplashControlPanel.ShowWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user