public static void Player_Awake_Postfix(uGUI_SceneHUD __instance)
 {
     foreach (KeyValuePair <string, HUDElementConfig> HUDElement in MainPatcher.HUDElements)
     {
         HUDElement.Value.Object = GameObject.Find(HUDElement.Key);
         if (HUDElement.Value.Object != null)
         {
             HUDElement.Value.OriginalLocation = HUDElement.Value.Object.transform.localPosition;
         }
     }
     MainPatcher.ConfigureHUD(1.0f);
 }
 public static void SceneHUD_Update_Postfix(uGUI_SceneHUD __instance)
 {
     if (MainPatcher.lookDownHUD)
     {
         if (Player.main != null && Vector3.Angle(MainCamera.camera.transform.forward, Player.main.transform.up) < 120f)
         {
             MainPatcher.ConfigureHUD(0.0f);
             return;
         }
     }
     MainPatcher.ConfigureHUD(1.0f);
 }
        // Class: uGUI_OptionsPanel
        public static void AddGeneralTab_Postfix(uGUI_OptionsPanel __instance)
        {
            __instance.AddHeading(tabIndex, "Additional VR Options");//add new heading under the General Tab
            __instance.AddToggleOption(tabIndex, "Enable VR Animations", GameOptions.enableVrAnimations, delegate(bool v)
            {
                GameOptions.enableVrAnimations = v;
                //playerAnimator vr_active is normally set in the Start function of Player so we need to update it if option changed during gameplay
                if (Player.main != null)
                {
                    Player.main.playerAnimator.SetBool("vr_active", !v);
                }
            });
            __instance.AddToggleOption(tabIndex, "Look Down for HUD", lookDownHUD, delegate(bool v)
            {
                lookDownHUD = v;
                //immediated reenable the HUD if option toggled off
                if (!v && quickSlots != null && barsPanel != null)
                {
                    MainPatcher.ConfigureHUD(1.0f);
                }
            });
            __instance.AddSliderOption(tabIndex, "Walk Speed (Default: 60%)", VROptions.groundMoveScale * 100, 50, 100, 60, delegate(float v)
            {
                VROptions.groundMoveScale = v / 100f;
            });

            /* Weird stuff was happening if the PDA was opened and when entering the Seamoth when pitch was changed with the mouse or controller
             * __instance.AddToggleOption(tabIndex, "Enable Pitch Control", !VROptions.disableInputPitch, delegate (bool v)
             * {
             *  VROptions.disableInputPitch = !v;
             *  //reset pitch to zero if pitch control is disabled.
             *  if (VROptions.disableInputPitch)
             *  {
             *      Player.main.GetComponentInChildren<MainCameraControl>().ResetCamera();
             *  }
             * });*/
            __instance.AddHeading(MainPatcher.tabIndex, "VR HUD");
            __instance.AddSliderOption(MainPatcher.tabIndex, "Subtitles Vertical Offset", MainPatcher.subtitlesVerticalOffset, -1000f, 1000f, 800f, delegate(float v)
            {
                MainPatcher.subtitlesVerticalOffset = v;
            });
            __instance.AddSliderOption(MainPatcher.tabIndex, "Subtitles Scale", MainPatcher.subtitlesScale * 100f, 10f, 200f, 100f, delegate(float v)
            {
                MainPatcher.subtitlesScale = v / 100f;
            });
            __instance.AddSliderOption(MainPatcher.tabIndex, "PDA Scale", MainPatcher.pdaScale * 100f, 10f, 200f, 128f, delegate(float v)
            {
                MainPatcher.pdaScale = v / 100f;
            });
            __instance.AddSliderOption(MainPatcher.tabIndex, "Menu Vertical Offset", MainPatcher.mainMenuVerticalOffset, -1000f, 1000f, 800f, delegate(float v)
            {
                MainPatcher.mainMenuVerticalOffset = v;
            });

            foreach (KeyValuePair <string, HUDElementConfig> ElementConfig in HUDElements)
            {
                string LabelPrefix = ElementConfig.Key + " ";
                __instance.AddSliderOption(MainPatcher.tabIndex, LabelPrefix + "Horizontal Offset", ElementConfig.Value.Offset.x, -999f, 999f, 0f, delegate(float v)
                {
                    ElementConfig.Value.Offset.x = v;
                });
                __instance.AddSliderOption(MainPatcher.tabIndex, LabelPrefix + "Vertical Offset", ElementConfig.Value.Offset.y, -999f, 999f, 0f, delegate(float v)
                {
                    ElementConfig.Value.Offset.y = v;
                });
                __instance.AddSliderOption(MainPatcher.tabIndex, LabelPrefix + "Scale", ElementConfig.Value.Scale * 100f, 5f, 200f, 1f, delegate(float v)
                {
                    ElementConfig.Value.Scale = v / 100f;
                });
            }
        }