2020-09-18 18:38:11 +10:00
|
|
|
|
using MelonLoader;
|
2020-08-27 18:05:55 +10:00
|
|
|
|
using UnityEngine;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
|
|
|
|
namespace Explorer
|
|
|
|
|
{
|
|
|
|
|
public class CppExplorer : MelonMod
|
|
|
|
|
{
|
2020-09-08 06:21:45 +10:00
|
|
|
|
public const string NAME = "CppExplorer";
|
2020-09-23 19:19:29 +10:00
|
|
|
|
public const string VERSION = "1.7.5";
|
2020-09-08 06:21:45 +10:00
|
|
|
|
public const string AUTHOR = "Sinai";
|
|
|
|
|
public const string GUID = "com.sinai.cppexplorer";
|
2020-08-13 23:34:21 +10:00
|
|
|
|
|
2020-08-27 18:05:55 +10:00
|
|
|
|
public static CppExplorer Instance { get; private set; }
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-08-27 18:05:55 +10:00
|
|
|
|
public static bool ShowMenu
|
|
|
|
|
{
|
|
|
|
|
get => m_showMenu;
|
|
|
|
|
set => SetShowMenu(value);
|
|
|
|
|
}
|
2020-09-11 18:53:17 +10:00
|
|
|
|
public static bool m_showMenu;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-08-27 18:05:55 +10:00
|
|
|
|
private static void SetShowMenu(bool show)
|
|
|
|
|
{
|
|
|
|
|
m_showMenu = show;
|
2020-09-11 18:53:17 +10:00
|
|
|
|
CursorControl.UpdateCursorControl();
|
2020-09-10 18:02:41 +10:00
|
|
|
|
}
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
|
|
|
|
public override void OnApplicationStart()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
|
2020-09-10 20:31:09 +10:00
|
|
|
|
ModConfig.OnLoad();
|
|
|
|
|
|
2020-09-08 23:47:17 +10:00
|
|
|
|
InputHelper.Init();
|
2020-09-08 17:07:10 +10:00
|
|
|
|
|
2020-08-07 22:19:03 +10:00
|
|
|
|
new MainMenu();
|
|
|
|
|
new WindowManager();
|
|
|
|
|
|
2020-09-11 18:53:17 +10:00
|
|
|
|
CursorControl.Init();
|
2020-08-27 18:05:55 +10:00
|
|
|
|
|
|
|
|
|
MelonLogger.Log($"CppExplorer {VERSION} initialized.");
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnLevelWasLoaded(int level)
|
|
|
|
|
{
|
2020-08-18 17:11:58 +10:00
|
|
|
|
ScenePage.Instance?.OnSceneChange();
|
|
|
|
|
SearchPage.Instance?.OnSceneChange();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnUpdate()
|
|
|
|
|
{
|
2020-09-10 20:31:09 +10:00
|
|
|
|
if (InputHelper.GetKeyDown(ModConfig.Instance.Main_Menu_Toggle))
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
|
|
|
|
ShowMenu = !ShowMenu;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ShowMenu)
|
|
|
|
|
{
|
2020-09-11 18:53:17 +10:00
|
|
|
|
CursorControl.Update();
|
|
|
|
|
InspectUnderMouse.Update();
|
2020-08-12 03:51:47 +10:00
|
|
|
|
|
2020-08-07 22:19:03 +10:00
|
|
|
|
MainMenu.Instance.Update();
|
|
|
|
|
WindowManager.Instance.Update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnGUI()
|
|
|
|
|
{
|
2020-09-04 01:27:44 +10:00
|
|
|
|
if (!ShowMenu) return;
|
|
|
|
|
|
2020-09-11 18:53:17 +10:00
|
|
|
|
var origSkin = GUI.skin;
|
|
|
|
|
GUI.skin = UIStyles.WindowSkin;
|
|
|
|
|
|
2020-08-07 22:19:03 +10:00
|
|
|
|
MainMenu.Instance.OnGUI();
|
|
|
|
|
WindowManager.Instance.OnGUI();
|
2020-08-18 17:11:58 +10:00
|
|
|
|
InspectUnderMouse.OnGUI();
|
2020-08-27 18:05:55 +10:00
|
|
|
|
|
2020-09-11 18:53:17 +10:00
|
|
|
|
GUI.skin = origSkin;
|
2020-08-30 01:08:48 +10:00
|
|
|
|
}
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
|
|
|
|
}
|