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

View file

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

View file

@ -19,6 +19,7 @@ public class QuickMenuHelper : MonoBehaviour
public Transform worldAnchor;
public Transform handAnchor;
public bool NeedsPositionUpdate;
public bool MenuIsOpen;
void Awake()
{
@ -27,12 +28,15 @@ public class QuickMenuHelper : MonoBehaviour
void LateUpdate()
{
if (MSP_MenuInfo.UseIndependentHeadTurn)
MSP_MenuInfo.HandleIndependentLookInput();
if (MSP_MenuInfo.PlayerAnchorMenus || MetaPort.Instance.isUsingVr)
UpdateMenuPosition();
if (NeedsPositionUpdate)
UpdateMenuPosition();
if (MenuIsOpen)
{
if (MSP_MenuInfo.UseIndependentHeadTurn)
MSP_MenuInfo.HandleIndependentLookInput();
if (MSP_MenuInfo.PlayerAnchorMenus || MetaPort.Instance.isUsingVr)
UpdateMenuPosition();
if (NeedsPositionUpdate)
UpdateMenuPosition();
}
}
public void CreateWorldAnchors()

View file

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