Beispiel #1
0
        public void EnterCamera()
        {
            usingCamera = true;
            InputHandlerStack.main.Push(this);
            Player main = Player.main;

            MainCameraControl.main.enabled = false;
            SNCameraRoot_Parent            = SNCameraRoot.main.transform.parent;
            SNCameraRoot.main.transform.SetParent(control_instance.CannonCamPosition.transform, false);
            Player.main.SetHeadVisible(true);
            VRUtil.Recenter();
            gameObject.SetActive(true);
        }
 public static void IGM_Awake_Postfix(IngameMenu __instance)
 {
     if (__instance != null && MainPatcher.recenterVRButton == null)
     {
         MainPatcher.recenterVRButton = UnityEngine.Object.Instantiate <Button>(__instance.quitToMainMenuButton.transform.parent.GetChild(0).gameObject.GetComponent <Button>(), __instance.quitToMainMenuButton.transform.parent);
         MainPatcher.recenterVRButton.transform.SetSiblingIndex(1);
         MainPatcher.recenterVRButton.name = "RecenterVR";
         MainPatcher.recenterVRButton.onClick.RemoveAllListeners();
         MainPatcher.recenterVRButton.onClick.AddListener(delegate()
         {
             VRUtil.Recenter();
         });
         foreach (Text text in MainPatcher.recenterVRButton.GetComponents <Text>().Concat(MainPatcher.recenterVRButton.GetComponentsInChildren <Text>()))
         {
             text.text = "Recenter VR";
         }
     }
 }
Beispiel #3
0
 //code copied from the quit to desktop mod and modified
 static void Postfix(IngameMenu __instance)
 {
     if (__instance != null && recenterVRButton == null)
     {
         //Clone the quitToMainMenuButton and update it
         Button menuButton = __instance.quitToMainMenuButton.transform.parent.GetChild(0).gameObject.GetComponent <Button>();
         recenterVRButton = UnityEngine.Object.Instantiate <Button>(menuButton, __instance.quitToMainMenuButton.transform.parent);
         recenterVRButton.transform.SetSiblingIndex(1); //put the button in the second position in the menu
         recenterVRButton.name = "RecenterVR";
         recenterVRButton.onClick.RemoveAllListeners(); //remove cloned listeners
         //add new listener
         recenterVRButton.onClick.AddListener(delegate()
         {
             VRUtil.Recenter();
         });
         //might be a better way to replace the text of the copied button
         IEnumerable <Text> enumerable = recenterVRButton.GetComponents <Text>().Concat(recenterVRButton.GetComponentsInChildren <Text>());
         foreach (Text text in enumerable)
         {
             text.text = "Recenter VR";
         }
     }
 }
 public static void Postfix(IngameMenu __instance)
 {
     if (__instance != null && recenterVRButton == null)
     {
         //I think this is copying an existing button
         Button menuButton = __instance.quitToMainMenuButton.transform.parent.GetChild(0).gameObject.GetComponent <Button>();
         recenterVRButton = UnityEngine.Object.Instantiate <Button>(menuButton, __instance.quitToMainMenuButton.transform.parent);
         recenterVRButton.transform.SetSiblingIndex(1); //put the button in the second position in the menu
         recenterVRButton.name = "RecenterVR";
         recenterVRButton.onClick.RemoveAllListeners(); //this seems to be removing listeners that would have been copied from the original button
                                                        //add new listener
         recenterVRButton.onClick.AddListener(delegate()
         {
             VRUtil.Recenter();
         });
         //might be a better way to replace the text of the copied button
         var enumerable = recenterVRButton.GetComponents <TextMeshProUGUI>().Concat(recenterVRButton.GetComponentsInChildren <TextMeshProUGUI>());
         foreach (var text in enumerable)
         {
             text.text = "Recenter VR";
         }
     }
 }