mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-03 20:12:33 +08:00
1.8.0, merging Mono and Il2Cpp builds, adding BepInEx support
* Project renamed to Explorer to reflect the new scope * Merged Mono and Il2Cpp builds * Merged BepInEx and MelonLoader builds * Some minor changes to accommodate for this * The release DLL and the config file now use "Explorer" in place of "CppExplorer" for file and folder names
This commit is contained in:
120
src/ExplorerCore.cs
Normal file
120
src/ExplorerCore.cs
Normal file
@ -0,0 +1,120 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Explorer
|
||||
{
|
||||
public class ExplorerCore
|
||||
{
|
||||
public const string NAME =
|
||||
#if ML
|
||||
#if CPP
|
||||
"Explorer (Il2Cpp, MelonLoader)";
|
||||
#else
|
||||
"Explorer (Mono, MelonLoader)";
|
||||
#endif
|
||||
#else
|
||||
#if CPP
|
||||
"Explorer (Il2Cpp, BepInEx)";
|
||||
#else
|
||||
"Explorer (Mono, BepInEx)";
|
||||
#endif
|
||||
#endif
|
||||
public const string VERSION = "1.8.0";
|
||||
public const string AUTHOR = "Sinai";
|
||||
public const string GUID = "com.sinai.explorer";
|
||||
|
||||
public static ExplorerCore Instance { get; private set; }
|
||||
|
||||
public ExplorerCore()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
ModConfig.OnLoad();
|
||||
|
||||
InputHelper.Init();
|
||||
|
||||
new MainMenu();
|
||||
new WindowManager();
|
||||
|
||||
CursorControl.Init();
|
||||
|
||||
Log($"{NAME} {VERSION} initialized.");
|
||||
}
|
||||
|
||||
public static bool ShowMenu
|
||||
{
|
||||
get => m_showMenu;
|
||||
set => SetShowMenu(value);
|
||||
}
|
||||
public static bool m_showMenu;
|
||||
|
||||
private static void SetShowMenu(bool show)
|
||||
{
|
||||
m_showMenu = show;
|
||||
CursorControl.UpdateCursorControl();
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
if (InputHelper.GetKeyDown(ModConfig.Instance.Main_Menu_Toggle))
|
||||
{
|
||||
ShowMenu = !ShowMenu;
|
||||
}
|
||||
|
||||
if (ShowMenu)
|
||||
{
|
||||
CursorControl.Update();
|
||||
InspectUnderMouse.Update();
|
||||
|
||||
MainMenu.Instance.Update();
|
||||
WindowManager.Instance.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnGUI()
|
||||
{
|
||||
if (!ShowMenu) return;
|
||||
|
||||
var origSkin = GUI.skin;
|
||||
GUI.skin = UIStyles.WindowSkin;
|
||||
|
||||
MainMenu.Instance.OnGUI();
|
||||
WindowManager.Instance.OnGUI();
|
||||
InspectUnderMouse.OnGUI();
|
||||
|
||||
GUI.skin = origSkin;
|
||||
}
|
||||
|
||||
public static void OnSceneChange()
|
||||
{
|
||||
ScenePage.Instance?.OnSceneChange();
|
||||
SearchPage.Instance?.OnSceneChange();
|
||||
}
|
||||
|
||||
public static void Log(string message)
|
||||
{
|
||||
#if ML
|
||||
MelonLoader.MelonLogger.Log(message);
|
||||
#else
|
||||
Explorer_BepInPlugin.Logging?.LogMessage(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void LogWarning(string message)
|
||||
{
|
||||
#if ML
|
||||
MelonLoader.MelonLogger.LogWarning(message);
|
||||
#else
|
||||
Explorer_BepInPlugin.Logging?.LogWarning(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void LogError(string message)
|
||||
{
|
||||
#if ML
|
||||
MelonLoader.MelonLogger.LogError(message);
|
||||
#else
|
||||
Explorer_BepInPlugin.Logging?.LogError(message);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user