Exemplo n.º 1
0
        public static void MakerAPI_ToggleValueChanged(string key, bool value)
        {
            ChaControl chaCtrl = MakerChaCtrl;

            MakerController.boolData[key] = value;

            switch (key)
            {
            case BoobController.OVERRIDE_PHYSICS:
                sliders[BoobController.DAMPING].Visible.OnNext(value);
                sliders[BoobController.ELASTICITY].Visible.OnNext(value);
                sliders[BoobController.STIFFNESS].Visible.OnNext(value);
                sliders[BoobController.INERT].Visible.OnNext(value);

                chaCtrl.UpdateBustSoftness();
                chaCtrl.ChangeBustInert(false);
                break;

            case BoobController.OVERRIDE_GRAVITY:
                sliders[BoobController.GRAVITY_X].Visible.OnNext(value);
                sliders[BoobController.GRAVITY_Y].Visible.OnNext(value);
                sliders[BoobController.GRAVITY_Z].Visible.OnNext(value);

                chaCtrl.UpdateBustGravity();
                break;

            case BoobController.BUTT + BoobController.OVERRIDE_PHYSICS:
                sliders[BoobController.BUTT + BoobController.DAMPING].Visible.OnNext(value);
                sliders[BoobController.BUTT + BoobController.ELASTICITY].Visible.OnNext(value);
                sliders[BoobController.BUTT + BoobController.STIFFNESS].Visible.OnNext(value);
                sliders[BoobController.BUTT + BoobController.INERT].Visible.OnNext(value);

                if (value)
                {
                    chaCtrl.UpdateBustSoftness();
                }
                else
                {
                    Util.ResetButtPhysics(chaCtrl.GetDynamicBoneBustAndHip(
                                              ChaControlDefine.DynamicBoneKind.HipL
                                              ));
                    Util.ResetButtPhysics(chaCtrl.GetDynamicBoneBustAndHip(
                                              ChaControlDefine.DynamicBoneKind.HipR
                                              ));
                }

                break;

            case BoobController.BUTT + BoobController.OVERRIDE_GRAVITY:
                sliders[BoobController.BUTT + BoobController.GRAVITY_X].Visible.OnNext(value);
                sliders[BoobController.BUTT + BoobController.GRAVITY_Y].Visible.OnNext(value);
                sliders[BoobController.BUTT + BoobController.GRAVITY_Z].Visible.OnNext(value);

                if (value)
                {
                    chaCtrl.UpdateBustGravity();
                }
                else
                {
                    Util.ResetButtGravity(chaCtrl.GetDynamicBoneBustAndHip(
                                              ChaControlDefine.DynamicBoneKind.HipL
                                              )); Util.ResetButtGravity(chaCtrl.GetDynamicBoneBustAndHip(
                                                                            ChaControlDefine.DynamicBoneKind.HipR
                                                                            ));
                }

                break;
            }
        }
Exemplo n.º 2
0
        public static bool PatchPrefix_BustSoft_ReCalc(ChaControl ___chaCtrl, ChaInfo ___info, int[] changePtn)
        {
            if (___chaCtrl == null ||
                ___info == null ||
                changePtn.Length == 0)
            {
                return(false);
            }

            BoobController controller = ___chaCtrl.GetComponent <BoobController>();

            if (controller == null)
            {
                return(true);
            }

            bool flag = true;

            if (controller.boolData[BoobController.OVERRIDE_PHYSICS])
            {
                flag = false;

                float damping    = controller.floatData[BoobController.DAMPING];
                float elasticity = controller.floatData[BoobController.ELASTICITY];
                float stiffness  = controller.floatData[BoobController.STIFFNESS];

                Util.UpdateBustSoftness(
                    ___chaCtrl.GetDynamicBoneBustAndHip(ChaControlDefine.DynamicBoneKind.BreastL),
                    changePtn,
                    damping,
                    elasticity,
                    stiffness
                    );
                Util.UpdateBustSoftness(
                    ___chaCtrl.GetDynamicBoneBustAndHip(ChaControlDefine.DynamicBoneKind.BreastR),
                    changePtn,
                    damping,
                    elasticity,
                    stiffness
                    );
                // Inert rarely gets updated. This makes sure it does.
                ___chaCtrl.ChangeBustInert(false);
            }

            if (controller.boolData[BoobController.BUTT + BoobController.OVERRIDE_PHYSICS])
            {
                float damping    = controller.floatData[BoobController.BUTT + BoobController.DAMPING];
                float elasticity = controller.floatData[BoobController.BUTT + BoobController.ELASTICITY];
                float stiffness  = controller.floatData[BoobController.BUTT + BoobController.STIFFNESS];
                float inert      = controller.floatData[BoobController.BUTT + BoobController.INERT];

                Util.UpdateButtPhysics(
                    ___chaCtrl.GetDynamicBoneBustAndHip(ChaControlDefine.DynamicBoneKind.HipL),
                    damping,
                    elasticity,
                    stiffness,
                    inert
                    );
                Util.UpdateButtPhysics(
                    ___chaCtrl.GetDynamicBoneBustAndHip(ChaControlDefine.DynamicBoneKind.HipR),
                    damping,
                    elasticity,
                    stiffness,
                    inert
                    );
            }

            return(flag);
        }