mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
polish my pain
This commit is contained in:
parent
4a5527d7de
commit
367a167469
5 changed files with 35 additions and 57 deletions
|
@ -1,12 +1,9 @@
|
|||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Core;
|
||||
using cohtml;
|
||||
using HarmonyLib;
|
||||
using NAK.Melons.MenuScalePatch.Helpers;
|
||||
using UnityEngine;
|
||||
using MenuScalePatch.Helpers;
|
||||
|
||||
namespace NAK.Melons.MenuScalePatch.HarmonyPatches;
|
||||
|
||||
|
@ -25,7 +22,7 @@ internal class HarmonyPatches
|
|||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CVR_MenuManager), "SetScale")]
|
||||
private static void SetQMScale(float avatarHeight, ref float ____scaleFactor, out bool __runOriginal)
|
||||
private static void Prefix_CVR_MenuManager_SetScale(float avatarHeight, ref float ____scaleFactor, out bool __runOriginal)
|
||||
{
|
||||
____scaleFactor = avatarHeight / 1.8f;
|
||||
if (MetaPort.Instance.isUsingVr) ____scaleFactor *= 0.5f;
|
||||
|
@ -35,7 +32,7 @@ internal class HarmonyPatches
|
|||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ViewManager), "SetScale")]
|
||||
private static void CheckMMScale(out bool __runOriginal)
|
||||
private static void Prefix_ViewManager_SetScale(out bool __runOriginal)
|
||||
{
|
||||
//bitch
|
||||
__runOriginal = false;
|
||||
|
@ -47,8 +44,10 @@ internal class HarmonyPatches
|
|||
[HarmonyPatch(typeof(CVR_MenuManager), "UpdateMenuPosition")]
|
||||
private static void Prefix_CVR_MenuManager_UpdateMenuPosition(out bool __runOriginal)
|
||||
{
|
||||
//fuck u
|
||||
__runOriginal = false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ViewManager), "UpdateMenuPosition")]
|
||||
private static void Prefix_ViewManager_UpdateMenuPosition(ref float ___cachedScreenAspectRatio, out bool __runOriginal)
|
||||
|
@ -63,7 +62,7 @@ internal class HarmonyPatches
|
|||
//Set QM stuff
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CVR_MenuManager), "Start")]
|
||||
private static void SetupQMHelper(ref CVR_MenuManager __instance, ref GameObject ____leftVrAnchor)
|
||||
private static void Postfix_CVR_MenuManager_Start(ref CVR_MenuManager __instance, ref GameObject ____leftVrAnchor)
|
||||
{
|
||||
QuickMenuHelper helper = __instance.quickMenu.gameObject.AddComponent<QuickMenuHelper>();
|
||||
helper.handAnchor = ____leftVrAnchor.transform;
|
||||
|
@ -72,7 +71,7 @@ internal class HarmonyPatches
|
|||
//Set MM stuff
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ViewManager), "Start")]
|
||||
private static void SetupMMHelper(ref ViewManager __instance)
|
||||
private static void Postfix_ViewManager_Start(ref ViewManager __instance)
|
||||
{
|
||||
__instance.gameObject.AddComponent<MainMenuHelper>();
|
||||
}
|
||||
|
@ -80,7 +79,7 @@ internal class HarmonyPatches
|
|||
//hook quickmenu open/close
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })]
|
||||
private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show, ref bool ____quickMenuOpen)
|
||||
private static void Prefix_CVR_MenuManager_ToggleQuickMenu(bool show, ref bool ____quickMenuOpen)
|
||||
{
|
||||
if (QuickMenuHelper.Instance == null) return;
|
||||
if (show != ____quickMenuOpen)
|
||||
|
@ -91,14 +90,6 @@ internal class HarmonyPatches
|
|||
QuickMenuHelper.Instance.enabled = show;
|
||||
}
|
||||
|
||||
//add independent head movement to important input
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(InputModuleMouseKeyboard), "UpdateImportantInput")]
|
||||
private static void Postfix_InputModuleMouseKeyboard_UpdateImportantInput(ref CVRInputManager ____inputManager)
|
||||
{
|
||||
____inputManager.independentHeadTurn |= Input.GetKey(KeyCode.LeftAlt);
|
||||
}
|
||||
|
||||
//hook menu open/close
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })]
|
||||
|
@ -113,10 +104,18 @@ internal class HarmonyPatches
|
|||
MainMenuHelper.Instance.enabled = show;
|
||||
}
|
||||
|
||||
//add independent head movement to important input
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(InputModuleMouseKeyboard), "UpdateImportantInput")]
|
||||
private static void Postfix_InputModuleMouseKeyboard_UpdateImportantInput(ref CVRInputManager ____inputManager)
|
||||
{
|
||||
____inputManager.independentHeadTurn |= Input.GetKey(KeyCode.LeftAlt);
|
||||
}
|
||||
|
||||
//Support for changing VRMode during runtime.
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlayerSetup), "CalibrateAvatar")]
|
||||
private static void CheckVRModeOnSwitch()
|
||||
private static void Postfix_PlayerSetup_CalibrateAvatar()
|
||||
{
|
||||
MSP_MenuInfo.CameraTransform = PlayerSetup.Instance.GetActiveCamera().transform;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue