losing it

This commit is contained in:
NotAKidoS 2023-02-15 05:21:03 -06:00
parent d15b446960
commit 0b035646d1
4 changed files with 24 additions and 18 deletions

View file

@ -91,7 +91,6 @@ internal class HarmonyPatches
{ {
QuickMenuHelper helper = __instance.quickMenu.gameObject.AddComponent<QuickMenuHelper>(); QuickMenuHelper helper = __instance.quickMenu.gameObject.AddComponent<QuickMenuHelper>();
helper.handAnchor = ____leftVrAnchor.transform; helper.handAnchor = ____leftVrAnchor.transform;
helper.enabled = false;
} }
catch (System.Exception e) catch (System.Exception e)
{ {
@ -106,8 +105,7 @@ internal class HarmonyPatches
{ {
try try
{ {
MainMenuHelper helper = __instance.gameObject.AddComponent<MainMenuHelper>(); __instance.gameObject.AddComponent<MainMenuHelper>();
helper.enabled = false;
} }
catch (System.Exception e) catch (System.Exception e)
{ {
@ -126,7 +124,7 @@ internal class HarmonyPatches
____quickMenuOpen = show; ____quickMenuOpen = show;
__instance.quickMenu.enabled = true; __instance.quickMenu.enabled = true;
__instance.quickMenuAnimator.SetBool("Open", show); __instance.quickMenuAnimator.SetBool("Open", show);
QuickMenuHelper.Instance.enabled = show; QuickMenuHelper.Instance.MenuIsOpen = show;
QuickMenuHelper.Instance.UpdateWorldAnchors(show); QuickMenuHelper.Instance.UpdateWorldAnchors(show);
//shouldnt run if switching menus on desktop //shouldnt run if switching menus on desktop
if (!MetaPort.Instance.isUsingVr) if (!MetaPort.Instance.isUsingVr)
@ -154,7 +152,7 @@ internal class HarmonyPatches
____gameMenuOpen = show; ____gameMenuOpen = show;
__instance.gameMenuView.enabled = true; __instance.gameMenuView.enabled = true;
__instance.uiMenuAnimator.SetBool("Open", show); __instance.uiMenuAnimator.SetBool("Open", show);
MainMenuHelper.Instance.enabled = show; MainMenuHelper.Instance.MenuIsOpen = show;
MainMenuHelper.Instance.UpdateWorldAnchors(show); MainMenuHelper.Instance.UpdateWorldAnchors(show);
//shouldnt run if switching menus on desktop //shouldnt run if switching menus on desktop
if (!MetaPort.Instance.isUsingVr) if (!MetaPort.Instance.isUsingVr)

View file

@ -21,6 +21,7 @@ public class MainMenuHelper : MonoBehaviour
public static MainMenuHelper Instance; public static MainMenuHelper Instance;
public Transform worldAnchor; public Transform worldAnchor;
public bool NeedsPositionUpdate; public bool NeedsPositionUpdate;
public bool MenuIsOpen;
void Awake() void Awake()
{ {
@ -28,6 +29,8 @@ public class MainMenuHelper : MonoBehaviour
} }
void LateUpdate() void LateUpdate()
{
if (MenuIsOpen)
{ {
if (MSP_MenuInfo.UseIndependentHeadTurn) if (MSP_MenuInfo.UseIndependentHeadTurn)
MSP_MenuInfo.HandleIndependentLookInput(); MSP_MenuInfo.HandleIndependentLookInput();
@ -36,6 +39,7 @@ public class MainMenuHelper : MonoBehaviour
if (NeedsPositionUpdate) if (NeedsPositionUpdate)
UpdateMenuPosition(); UpdateMenuPosition();
} }
}
public void CreateWorldAnchors() public void CreateWorldAnchors()
{ {

View file

@ -19,6 +19,7 @@ public class QuickMenuHelper : MonoBehaviour
public Transform worldAnchor; public Transform worldAnchor;
public Transform handAnchor; public Transform handAnchor;
public bool NeedsPositionUpdate; public bool NeedsPositionUpdate;
public bool MenuIsOpen;
void Awake() void Awake()
{ {
@ -26,6 +27,8 @@ public class QuickMenuHelper : MonoBehaviour
} }
void LateUpdate() void LateUpdate()
{
if (MenuIsOpen)
{ {
if (MSP_MenuInfo.UseIndependentHeadTurn) if (MSP_MenuInfo.UseIndependentHeadTurn)
MSP_MenuInfo.HandleIndependentLookInput(); MSP_MenuInfo.HandleIndependentLookInput();
@ -34,6 +37,7 @@ public class QuickMenuHelper : MonoBehaviour
if (NeedsPositionUpdate) if (NeedsPositionUpdate)
UpdateMenuPosition(); UpdateMenuPosition();
} }
}
public void CreateWorldAnchors() public void CreateWorldAnchors()
{ {

View file

@ -25,6 +25,6 @@ using System.Reflection;
namespace NAK.Melons.MenuScalePatch.Properties; namespace NAK.Melons.MenuScalePatch.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "4.2.2"; public const string Version = "4.2.3";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }