コード例 #1
0
        public override void VRChat_OnUiManagerInit()
        {
            var calibrateButton = GameObject.Find("UserInterface/QuickMenu/ShortcutMenu/CalibrateButton")
                                  .GetComponent <Button>();
            var oldCalibrate = calibrateButton.onClick;

            calibrateButton.onClick = new Button.ButtonClickedEvent();
            calibrateButton.onClick.AddListener(new Action(() =>
            {
                if (IkTweaksSettings.FullBodyVrIk)
                {
                    if (IkTweaksSettings.CalibrateUseUniversal)
                    {
                        CalibrationManager.Clear();
                    }
                    else
                    {
                        CalibrationManager.Clear(VRCPlayer.field_Internal_Static_VRCPlayer_0.prop_ApiAvatar_0.id);
                    }
                }

                oldCalibrate.Invoke();
            }));

            var steamVrControllerManager = CalibrationManager.GetControllerManager();
            var puckPrefab = steamVrControllerManager.field_Public_ArrayOf_GameObject_0.First(it =>
                                                                                              it != steamVrControllerManager.field_Public_GameObject_1 && it != steamVrControllerManager.field_Public_GameObject_0);
            var newPucks = new Il2CppReferenceArray <GameObject>(5 + 6);
            var newUints = new Il2CppStructArray <uint>(5 + 6);

            for (var i = 0; i < 5; i++)
            {
                newPucks[i] = steamVrControllerManager.field_Public_ArrayOf_GameObject_0[i];
                newUints[i] = steamVrControllerManager.field_Private_ArrayOf_UInt32_0[i];
            }

            ourRandomPuck = puckPrefab;

            var trackersParent = puckPrefab.transform.parent;

            for (var i = 0; i < 6; i++)
            {
                var newPuck = Object.Instantiate(puckPrefab, trackersParent, true);
                newPuck.name = "Puck" + (i + 4);
                newPuck.GetComponent <SteamVR_TrackedObject>().field_Public_EnumNPublicSealedvaNoHmDe18DeDeDeDeDeUnique_0 = SteamVR_TrackedObject.EnumNPublicSealedvaNoHmDe18DeDeDeDeDeUnique.None;
                newPuck.SetActive(false);
                newPucks[i + 5] = newPuck;
                newUints[i + 5] = UInt32.MaxValue;
            }

            steamVrControllerManager.field_Public_ArrayOf_GameObject_0 = newPucks;
            steamVrControllerManager.field_Private_ArrayOf_UInt32_0    = newUints;

            // only one of them is the correct type, so just try all of them
            steamVrControllerManager.field_Private_Action_0.TryCast <SteamVR_Events.Action <VREvent_t> >()?.action?.Invoke(new VREvent_t());
            steamVrControllerManager.field_Private_Action_1.TryCast <SteamVR_Events.Action <VREvent_t> >()?.action?.Invoke(new VREvent_t());
            steamVrControllerManager.field_Private_Action_2.TryCast <SteamVR_Events.Action <VREvent_t> >()?.action?.Invoke(new VREvent_t());
        }
コード例 #2
0
        private static void FbbIkInitPostfix(Animator __1, bool __3)
        {
            if (!__3 || !IkTweaksSettings.FullBodyVrIk || !ourIsFbtSupported())
            {
                return;
            }

            LastCalibrationWasInCustomIk = true;
            CalibrationManager.Calibrate(__1.gameObject);
        }