Initial commit
This commit is contained in:
commit
72137fd19b
5 changed files with 469 additions and 0 deletions
32
Plugin.cs
Normal file
32
Plugin.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using BepInEx;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BoxPause
|
||||
{
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
public class Plugin : BaseUnityPlugin
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
// Plugin startup logic
|
||||
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_NAME} is loaded!");
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
var obj = GameObject.Find("Player");
|
||||
if (obj == null || !obj.active) return;
|
||||
//Logger.Log(BepInEx.Logging.LogLevel.Message, "Escape has been pressed.");
|
||||
if (obj.GetComponent<PlayerInteraction>().InInteraction)
|
||||
{
|
||||
//Logger.Log(BepInEx.Logging.LogLevel.Message, "Box is being held. Invoking Pause method.");
|
||||
var mng = GameObject.Find("Escape Menu").GetComponent<EscapeMenuManager>();
|
||||
var prop = typeof(EscapeMenuManager).GetProperty("OpenEscapeMenu", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
var memb = typeof(EscapeMenuManager).GetField("m_Paused", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
prop.SetValue(mng, (bool)memb.GetValue(mng) == false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue