コード例 #1
0
 public static void H_Lookat_dan_PostLateUpdate()
 {
     if (hScene != null)
     {
         SliderUI.SaveBasePoints(useReplacements);
     }
 }
コード例 #2
0
        //-- Draw chara draggers UI --//
        private void OnGUI()
        {
            if (activeDraggerUI && hScene != null)
            {
                SliderUI.DrawDraggersUI();
            }

            if (activeAnimationUI && hScene != null)
            {
                AnimationUI.DrawAnimationUI();
            }
        }
コード例 #3
0
        private static void HScene_PreChangeAnimation()
        {
            if (applySavedOffsets.Value)
            {
                shouldApplyOffsets = true;
            }

            if (hScene == null)
            {
                return;
            }

            SliderUI.ClearBaseReplacements();
            bBaseReplacement   = false;
            bIdleGlowException = false;
            bFootJobException  = false;
            bTwoFootException  = false;
        }
コード例 #4
0
        public static bool SolverManager_PreLateUpdate(RootMotion.SolverManager __instance)
        {
            if (hScene == null)
            {
                return(true);
            }

            ChaControl character = __instance.GetComponentInParent <ChaControl>();

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

            int charIndex = 1;

            if (character.chaID == (int)ChaID.FirstFemale || character.chaID == (int)ChaID.SecondFemale)
            {
                charIndex = maleCharacters.Count + character.chaID;
            }
            else if (character.chaID == (int)ChaID.FirstMale)
            {
                charIndex = 0;
            }

            if (enableAnimationFixer.Value && solveDependenciesFirst.Value && character.chaID != (int)ChaID.FirstFemale && character.chaID != (int)ChaID.SecondFemale && SliderUI.characterOffsets[charIndex].dependentAnimation)
            {
                return(false);
            }

            if (character.chaID == (int)ChaID.FirstFemale || character.chaID == (int)ChaID.SecondFemale)
            {
                bool leftFootJob  = bFootJobException && (!bTwoFootException || currentMotion.Contains("Idle") || currentMotion.Contains("WLoop"));
                bool rightFootJob = bFootJobException && bTwoFootException && currentMotion.Contains("O");
                SliderUI.ApplyLimbOffsets(charIndex, useLastSolutionForFemales.Value, useReplacements, leftFootJob, rightFootJob);
            }
            else
            {
                SliderUI.ApplyLimbOffsets(charIndex, useLastSolutionForMales.Value, useReplacements, false, false);
            }
            return(true);
        }
コード例 #5
0
        public static void SolverManager_PostLateUpdate(RootMotion.SolverManager __instance)
        {
            if (hScene == null || !enableAnimationFixer.Value || !solveDependenciesFirst.Value)
            {
                return;
            }

            ChaControl character = __instance.GetComponentInParent <ChaControl>();

            if (character == null || character.chaID != (int)ChaID.FirstFemale)
            {
                return;
            }

            for (var charIndex = 0; charIndex < maleCharacters.Count; charIndex++)
            {
                if (SliderUI.characterOffsets[charIndex].dependentAnimation)
                {
                    SliderUI.ApplyLimbOffsets(charIndex, useLastSolutionForMales.Value, useReplacements, false, false);
                    maleCharacters[charIndex].fullBodyIK.UpdateSolverExternal();
                }
            }
        }
コード例 #6
0
        public static void FixMotionList(string fileFemale)
        {
            SliderUI.ClearBaseReplacements();
            bBaseReplacement   = false;
            bIdleGlowException = false;
            bFootJobException  = false;
            bTwoFootException  = false;

            if (!fixAttachmentPoints.Value || maleCharacters == null || maleCharacters[0] == null || femaleCharacters == null || femaleCharacters[0] == null)
            {
                return;
            }

            if (siriReplaceList.Contains(fileFemale))
            {
                Transform leftContact  = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_siriL_00")).FirstOrDefault();
                Transform rightContact = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_siriR_00")).FirstOrDefault();

                if (leftContact != null)
                {
                    SliderUI.SetBaseReplacement(0, (int)BodyPart.LeftHand, leftContact);
                }

                if (rightContact != null)
                {
                    SliderUI.SetBaseReplacement(0, (int)BodyPart.RightHand, rightContact);
                }

                bBaseReplacement = true;
            }
            else if (kosiReplaceList.Contains(fileFemale))
            {
                Transform leftContact  = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_kosi02_00")).FirstOrDefault();
                Transform rightContact = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_kosi02_01")).FirstOrDefault();

                if (leftContact != null)
                {
                    SliderUI.SetBaseReplacement(0, (int)BodyPart.LeftHand, leftContact);
                }

                if (rightContact != null)
                {
                    SliderUI.SetBaseReplacement(0, (int)BodyPart.RightHand, rightContact);
                }

                bBaseReplacement = true;
            }
            else if (huggingReplaceList.Contains(fileFemale))
            {
                Transform leftContact  = maleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_spine03_00")).FirstOrDefault();
                Transform rightContact = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_armlowL_00")).FirstOrDefault();

                if (leftContact != null)
                {
                    SliderUI.SetBaseReplacement(maleCharacters.Count, (int)BodyPart.LeftHand, leftContact);
                }

                if (rightContact != null)
                {
                    SliderUI.SetBaseReplacement(maleCharacters.Count, (int)BodyPart.RightHand, rightContact);
                }

                bBaseReplacement = true;
            }
            else if (footReplaceList.Contains(fileFemale))
            {
                Transform leftAnkleReference = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("f_k_foot_L")).FirstOrDefault();
                Transform leftDanReference   = maleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_m_dansao00_00")).FirstOrDefault();

                if (leftAnkleReference != null)
                {
                    SliderUI.SetBaseReplacement(maleCharacters.Count, (int)BodyPart.LeftFoot, leftAnkleReference);
                }
                if (leftDanReference != null)
                {
                    SliderUI.SetBaseReplacement(maleCharacters.Count, (int)BodyPart.LeftHand, leftDanReference);
                }

                bFootJobException = true;

                if (fileFemale != footReplaceList[0])
                {
                    Transform rightAnkleReference = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("f_k_foot_R")).FirstOrDefault();
                    Transform rightDanReference   = maleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_m_dansao00_01")).FirstOrDefault();


                    if (rightAnkleReference != null)
                    {
                        SliderUI.SetBaseReplacement(maleCharacters.Count, (int)BodyPart.RightFoot, rightAnkleReference);
                    }
                    if (rightDanReference != null)
                    {
                        SliderUI.SetBaseReplacement(maleCharacters.Count, (int)BodyPart.RightHand, rightDanReference);
                    }

                    bTwoFootException = true;
                }
            }
            else if (rightKokanReplaceList.Contains(fileFemale))
            {
                Transform rightContact = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_kokan_00")).FirstOrDefault();
                if (rightContact != null)
                {
                    SliderUI.SetBaseReplacement(0, (int)BodyPart.RightHand, rightContact);
                }

                bBaseReplacement   = true;
                bIdleGlowException = true;
            }
            else if (leftKokanReplaceList.Contains(fileFemale))
            {
                Transform leftContact = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_kokan_00")).FirstOrDefault();
                if (leftContact != null)
                {
                    SliderUI.SetBaseReplacement(0, (int)BodyPart.LeftHand, leftContact);
                }

                bBaseReplacement   = true;
                bIdleGlowException = true;
            }
            else if (rightKosiReplaceList.Contains(fileFemale))
            {
                Transform rightContact = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_kosi02_00")).FirstOrDefault();
                if (rightContact != null)
                {
                    SliderUI.SetBaseReplacement(0, (int)BodyPart.RightHand, rightContact);
                }

                bBaseReplacement   = true;
                bIdleGlowException = true;
            }
            else if (leftKosiReplaceList.Contains(fileFemale))
            {
                Transform leftContact = femaleCharacters[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("k_f_kosi02_00")).FirstOrDefault();
                if (leftContact != null)
                {
                    SliderUI.SetBaseReplacement(0, (int)BodyPart.LeftHand, leftContact);
                }

                bBaseReplacement   = true;
                bIdleGlowException = true;
            }

            useReplacements = bBaseReplacement && !bFootJobException && (!bIdleGlowException || (!currentMotion.Contains("Idle") && !currentMotion.Contains("_A")));
        }
コード例 #7
0
        public static void HScene_SetStartAnimationInfo_Patch(HScene __instance, HSceneSprite ___sprite)
        {
            hScene  = __instance;
            hSprite = ___sprite;

            if (hScene == null || hSprite == null)
            {
                return;
            }

            hFlagCtrl = hScene.ctrlFlag;
            if (hFlagCtrl == null)
            {
                return;
            }

            cameraCtrl = hFlagCtrl.cameraCtrl;
            if (cameraCtrl == null)
            {
                return;
            }

            hSceneTrav          = Traverse.Create(hScene);
            Tools.hFlagCtrlTrav = Traverse.Create(hFlagCtrl);

            listTrav       = Traverse.Create(hScene.ctrlEyeNeckMale[0]);
            maleMotionList = listTrav?.Field("lstEyeNeck").GetValue <List <HMotionEyeNeckMale.EyeNeck> >();

            if (unlockCamera.Value)
            {
                cameraCtrl.isLimitDir = false;
                cameraCtrl.isLimitPos = false;
            }

            cameraShouldLock = true;

            characters     = new List <ChaControl>();
            maleCharacters = new List <ChaControl>();
            ChaControl[] males = __instance.GetMales();
            foreach (var male in males.Where(male => male != null))
            {
                maleCharacters.Add(male);
                characters.Add(male);
            }

            femaleCharacters = new List <ChaControl>();
            ChaControl[] females = __instance.GetFemales();
            foreach (var female in females.Where(female => female != null))
            {
                femaleCharacters.Add(female);
                characters.Add(female);
            }

            if (characters == null)
            {
                return;
            }

            obiSolver = GameObject.Find("SiruObiMgr").GetComponentInChildren <Obi.ObiSolver>(true);

            if (obiSolver != null)
            {
                obiSolver.UpdateOrder = obiUpdateMode.Value;
            }

            Tools.SetGotoWeaknessCount(countToWeakness.Value);
            SliderUI.InitDraggersUI();
        }
コード例 #8
0
        //-- Apply chara offsets --//
        //-- Auto finish, togle chara draggers UI --//
        private void Update()
        {
            if (hScene == null)
            {
                return;
            }

            if (showDraggerUI.Value.IsDown())
            {
                activeDraggerUI = !activeDraggerUI;
            }

            if (showAnimationUI.Value.IsDown())
            {
                activeAnimationUI = !activeAnimationUI;
            }

            if (shouldApplyOffsets && !hScene.NowChangeAnim)
            {
                HSceneOffset.ApplyCharacterOffsets();
                SliderUI.UpdateDependentStatus();
                FixMotionList(hScene.ctrlFlag.nowAnimationInfo.fileFemale);
                FixEffectors();
                shouldApplyOffsets = false;
            }

            if (autoFinish.Value == Tools.AutoFinish.Off)
            {
                return;
            }

            if (hFlagCtrl.feel_m >= 0.98f && Tools.IsService() && autoFinish.Value != Tools.AutoFinish.InsertOnly)
            {
                // same mode as OnBody only for some reason
                var drink = hSprite.IsFinishVisible(1) && Tools.modeCtrl != 0 && !(!hSprite.IsFinishVisible(4) && hSprite.IsFinishVisible(1) && Tools.modeCtrl == 1);
                var vomit = hSprite.IsFinishVisible(3);
                // same mode as drink for some reason
                var onbody = hSprite.IsFinishVisible(4) || (hSprite.IsFinishVisible(1) && (Tools.modeCtrl == 0 || Tools.modeCtrl == 1));

                switch (autoServicePrefer.Value)
                {
                case Tools.AutoServicePrefer.Drink when drink:
                    hFlagCtrl.click = HSceneFlagCtrl.ClickKind.FinishDrink;
                    break;

                case Tools.AutoServicePrefer.Spit when vomit:
                    hFlagCtrl.click = HSceneFlagCtrl.ClickKind.FinishVomit;
                    break;

                case Tools.AutoServicePrefer.Outside when onbody:
                    hFlagCtrl.click = HSceneFlagCtrl.ClickKind.FinishOutSide;
                    break;

                case Tools.AutoServicePrefer.Random:
                    var random = new List <HSceneFlagCtrl.ClickKind>();
                    if (drink)
                    {
                        random.Add(HSceneFlagCtrl.ClickKind.FinishDrink);
                    }
                    if (vomit)
                    {
                        random.Add(HSceneFlagCtrl.ClickKind.FinishVomit);
                    }
                    if (onbody)
                    {
                        random.Add(HSceneFlagCtrl.ClickKind.FinishOutSide);
                    }

                    if (random.Count < 1)
                    {
                        break;
                    }

                    hFlagCtrl.click = random[rand.Next(random.Count)];
                    break;
                }
            }
            else if (hFlagCtrl.feel_f >= 0.98f && hFlagCtrl.feel_m >= 0.98f && Tools.IsInsert() && autoFinish.Value != Tools.AutoFinish.ServiceOnly)
            {
                var inside  = hSprite.IsFinishVisible(1);
                var outside = hSprite.IsFinishVisible(5);
                var same    = hSprite.IsFinishVisible(2);

                switch (autoInsertPrefer.Value)
                {
                case Tools.AutoInsertPrefer.Inside when inside:
                    hFlagCtrl.click = HSceneFlagCtrl.ClickKind.FinishInSide;
                    break;

                case Tools.AutoInsertPrefer.Outside when outside:
                    hFlagCtrl.click = HSceneFlagCtrl.ClickKind.FinishOutSide;
                    break;

                case Tools.AutoInsertPrefer.Same when same:
                    hFlagCtrl.click = HSceneFlagCtrl.ClickKind.FinishSame;
                    break;

                case Tools.AutoInsertPrefer.Random:
                    var random = new List <HSceneFlagCtrl.ClickKind>();
                    if (inside)
                    {
                        random.Add(HSceneFlagCtrl.ClickKind.FinishInSide);
                    }
                    if (outside)
                    {
                        random.Add(HSceneFlagCtrl.ClickKind.FinishOutSide);
                    }
                    if (same)
                    {
                        random.Add(HSceneFlagCtrl.ClickKind.FinishSame);
                    }

                    if (random.Count < 1)
                    {
                        break;
                    }

                    hFlagCtrl.click = random[rand.Next(random.Count)];
                    break;
                }
            }
        }
コード例 #9
0
        private void Awake()
        {
            Logger = base.Logger;

            showDraggerUI   = Config.Bind("Animations > Draggers", "Show draggers UI", new KeyboardShortcut(KeyCode.N));
            showAnimationUI = Config.Bind("Animations > Draggers", "Show animation UI", new KeyboardShortcut(KeyCode.N, KeyCode.LeftControl), new ConfigDescription("Displays a UI that can be used to change the current animation motion.  Intended to be used with draggers UI to make adjustments.  May break the flow of an HScene so use with caution."));
            (applySavedOffsets = Config.Bind("Animations > Draggers", "Apply saved offsets", true, new ConfigDescription("Apply previously saved character offsets for character pair / position during H"))).SettingChanged += delegate
            {
                if (applySavedOffsets.Value)
                {
                    shouldApplyOffsets = true;
                }
            };
            useOneOffsetForAllMotions = Config.Bind("Animations > Draggers", "Use one offset for all motions", true, new ConfigDescription("If disabled, the Save button in the UI will only save the offsets for the current motion of the position.  A Default button will be added to save it for all motions of that position that don't already have an offset."));
            offsetFile        = Config.Bind("Animations > Draggers", "Offset File Path", "UserData/BetterHScenesOffsets.xml", new ConfigDescription("Path of the offset file card on disk."));
            sliderMaxPosition = Config.Bind("Animations > Draggers", "Slider min/max position", 2.5f, new ConfigDescription("Maximum limits of the position slider bars."));
            sliderMaxRotation = Config.Bind("Animations > Draggers", "Slider min/max rotation", 45f, new ConfigDescription("Maximum limits of the rotation slider bars."));

            (solveDependenciesFirst = Config.Bind("Animations > Solver", "Solve Independent Animations First", true, new ConfigDescription("Re-orders animation solving.  If the male animation is dependent on the female animation, the female animation will be solved first.  Some animations have both male and female dependencies.  These ones will run females first, so female dependencies will be broken.  This can be fixed by using last frame (see below)"))).SettingChanged += delegate
            {
                if (hScene != null)
                {
                    SliderUI.UpdateDependentStatus();
                }
            };
            useLastSolutionForFemales = Config.Bind("Animations > Solver", "Use Last Frame Solutions for Females", true, new ConfigDescription("Use Last Frame's result as input to next frame.  This can fix problems when the female animations are solved before the male animations but are dependent on the male animations.  It will add a framerate dependent amount of jitter to the animations, which can be a good thing if your fps is high, or a bad thing if your fps is low."));
            useLastSolutionForMales   = Config.Bind("Animations > Solver", "Use Last Frame Solutions for Males", false, new ConfigDescription("Use Last Frame's result as input to next frame.  This can fix problems when the male animations are solved before the female animatiosn but are dependent on the male animations.  It will add a framerate dependent amount of jitter to the animations, which can be a good thing if your fps is high, or a bad thing if your fps is low."));
            enableAnimationFixer      = Config.Bind("Animations > Solver", "Enable Animation Fixer", true, new ConfigDescription("Corrects most animations by using the other characters solutions if available. No other solver options will work without this enabled."));
            (fixAttachmentPoints = Config.Bind("Animations > Solver", "Fix broken Animation Tables", true, new ConfigDescription("Corrects certain animations by attaching certain IK points to the correct location instead of leaving them dangling in air."))).SettingChanged += delegate
            {
                if (hScene != null)
                {
                    FixMotionList(hScene.ctrlFlag.nowAnimationInfo.fileFemale);
                }
            };

            (fixEffectors = Config.Bind("Animations > Solver", "Fix broken Effectors", false, new ConfigDescription("Allows limb movement on certain positions by fixing their effector weights."))).SettingChanged += delegate
            {
                if (hScene != null)
                {
                    FixEffectors();
                }
            };

            preventDefaultAnimationChangeStrip = Config.Bind("QoL > Clothes", "Prevent default animationchange strip", true, new ConfigDescription("Prevent default animation change clothes strip (pants, panties, top half state)"));

            stripMaleClothes   = Config.Bind("QoL > Clothes", "Should strip male clothes", Tools.OffHStartAnimChange.OnHStart, new ConfigDescription("Should strip male clothes during H"));
            stripMaleTop       = Config.Bind("QoL > Clothes", "Strip male top", Tools.ClothesStrip.All, new ConfigDescription("Strip male top during H"));
            stripMaleBottom    = Config.Bind("QoL > Clothes", "Strip male bottom", Tools.ClothesStrip.All, new ConfigDescription("Strip male bottom during H"));
            stripMaleBra       = Config.Bind("QoL > Clothes", "Strip male bra", Tools.ClothesStrip.Half, new ConfigDescription("Strip male (futa) bra during H"));
            stripMalePanties   = Config.Bind("QoL > Clothes", "Strip male panties", Tools.ClothesStrip.Half, new ConfigDescription("Strip male (futa) panties during H"));
            stripMaleGloves    = Config.Bind("QoL > Clothes", "Strip male gloves", Tools.ClothesStrip.Off, new ConfigDescription("Strip male gloves during H"));
            stripMalePantyhose = Config.Bind("QoL > Clothes", "Strip male pantyhose", Tools.ClothesStrip.Half, new ConfigDescription("Strip male (futa) pantyhose during H"));
            stripMaleSocks     = Config.Bind("QoL > Clothes", "Strip male socks", Tools.ClothesStrip.Off, new ConfigDescription("Strip male (futa) socks during H"));
            stripMaleShoes     = Config.Bind("QoL > Clothes", "Strip male shoes", Tools.ClothesStrip.Off, new ConfigDescription("Strip male shoes during H"));

            stripFemaleClothes   = Config.Bind("QoL > Clothes", "Should strip female clothes", Tools.OffHStartAnimChange.Both, new ConfigDescription("Should strip female clothes during H"));
            stripFemaleTop       = Config.Bind("QoL > Clothes", "Strip female top", Tools.ClothesStrip.Half, new ConfigDescription("Strip female top during H"));
            stripFemaleBottom    = Config.Bind("QoL > Clothes", "Strip female bottom", Tools.ClothesStrip.Half, new ConfigDescription("Strip female bottom during H"));
            stripFemaleBra       = Config.Bind("QoL > Clothes", "Strip female bra", Tools.ClothesStrip.Half, new ConfigDescription("Strip female bra during H"));
            stripFemalePanties   = Config.Bind("QoL > Clothes", "Strip female panties", Tools.ClothesStrip.Half, new ConfigDescription("Strip female panties during H"));
            stripFemaleGloves    = Config.Bind("QoL > Clothes", "Strip female gloves", Tools.ClothesStrip.Off, new ConfigDescription("Strip female gloves during H"));
            stripFemalePantyhose = Config.Bind("QoL > Clothes", "Strip female pantyhose", Tools.ClothesStrip.Half, new ConfigDescription("Strip female pantyhose during H"));
            stripFemaleSocks     = Config.Bind("QoL > Clothes", "Strip female socks", Tools.ClothesStrip.Off, new ConfigDescription("Strip female socks during H"));
            stripFemaleShoes     = Config.Bind("QoL > Clothes", "Strip female shoes", Tools.ClothesStrip.Off, new ConfigDescription("Strip female shoes during H"));

            (countToWeakness = Config.Bind("QoL > Weakness", "O****m count until weakness", 3, new ConfigDescription("How many times does the girl have to o****m to reach weakness", new AcceptableValueRange <int>(1, 999)))).SettingChanged += (s, e) => Tools.SetGotoWeaknessCount(countToWeakness.Value);
            forceTears        = Config.Bind("QoL > Weakness", "Force show tears", Tools.OffWeaknessAlways.WeaknessOnly, new ConfigDescription("Make girl cry"));
            forceCloseEyes    = Config.Bind("QoL > Weakness", "Force close eyes", Tools.OffWeaknessAlways.Off, new ConfigDescription("Close girl eyes"));
            forceStopBlinking = Config.Bind("QoL > Weakness", "Force stop blinking", Tools.OffWeaknessAlways.Off, new ConfigDescription("Stop blinking"));
            alwaysGaugesHeart = Config.Bind("QoL > Weakness", "Always hit gauge heart", Tools.OffWeaknessAlways.WeaknessOnly, new ConfigDescription("Always hit gauge heart. Will cause progress to increase without having to scroll specific amount"));

            autoFinish        = Config.Bind("QoL > Cum", "Auto finish", Tools.AutoFinish.Both, new ConfigDescription("Automatically finish inside when both gauges reach max"));
            autoServicePrefer = Config.Bind("QoL > Cum", "Preferred auto service finish", Tools.AutoServicePrefer.Drink, new ConfigDescription("Preferred auto finish type. Will fall back to any available option if selected is not available"));
            autoInsertPrefer  = Config.Bind("QoL > Cum", "Preferred auto insert finish", Tools.AutoInsertPrefer.Same, new ConfigDescription("Preferred auto finish type. Will fall back to any available option if selected is not available"));

            (obiUpdateMode = Config.Bind("QoL > Cum", "Detailed Cum Update Mode", Obi.ObiSolver.UpdateMode.FixedUpdate, new ConfigDescription("Update method for detailed cum, use LateUpdate for best framerate"))).SettingChanged += (s, e) =>
            {
                if (obiSolver == null)
                {
                    return;
                }

                obiSolver.UpdateOrder = obiUpdateMode.Value;
            };

            (unlockCamera = Config.Bind("QoL > General", "Unlock camera movement", true, new ConfigDescription("Unlock camera zoom out / distance limit during H"))).SettingChanged += (s, e) =>
            {
                if (cameraCtrl == null)
                {
                    return;
                }

                cameraCtrl.isLimitDir = !unlockCamera.Value;
                cameraCtrl.isLimitPos = !unlockCamera.Value;
            };

            shouldApplyOffsets = false;
            HSceneOffset.LoadOffsetsFromFile();

            harmony = new Harmony(nameof(HS2_BetterHScenes));

            SceneManager.sceneLoaded += SceneManager_sceneLoaded;
        }
コード例 #10
0
        //-- Apply character offsets for current animation, if they can be found --//
        public static void ApplyCharacterOffsets()
        {
            var currentAnimation   = HS2_BetterHScenes.hFlagCtrl.nowAnimationInfo.nameAnimation;
            var bValidOffsetsFound = false;

            if (currentAnimation == null)
            {
                return;
            }

            if (HS2_BetterHScenes.currentMotion == null)
            {
                HS2_BetterHScenes.currentMotion = "default";
            }

            string characterPairName = null;

            foreach (var character in HS2_BetterHScenes.characters.Where(character => character != null && character.visibleAll))
            {
                if (characterPairName == null)
                {
                    characterPairName = character.fileParam.fullname;
                }
                else
                {
                    characterPairName += "_" + character.fileParam.fullname;
                }
            }

            var animationList = animationOffsets.Animations.Find(x => x.AnimationName == currentAnimation);

            if (animationList != null && characterPairName != null)
            {
                MotionList motionList;
                if (HS2_BetterHScenes.useOneOffsetForAllMotions.Value)
                {
                    motionList = animationList.MotionList.Find(x => x.MotionName == "default");
                }
                else
                {
                    motionList = animationList.MotionList.Find(x => x.MotionName == HS2_BetterHScenes.currentMotion);
                    if (motionList == null)
                    {
                        motionList = animationList.MotionList.Find(x => x.MotionName == "default");
                    }
                    else if (motionList.MotionName != HS2_BetterHScenes.currentMotion)
                    {
                        motionList = animationList.MotionList.Find(x => x.MotionName == "default");
                    }
                }

                var characterPair = motionList?.CharacterPairList.Find(x => x.CharacterPairName == characterPairName);
                if (characterPair != null)
                {
                    for (var charIndex = 0; charIndex < HS2_BetterHScenes.characters.Count; charIndex++)
                    {
                        var characterOffsetParameters = characterPair.CharacterOffsets.Find(x => x.CharacterName == HS2_BetterHScenes.characters[charIndex].fileParam.fullname);
                        if (characterOffsetParameters == null)
                        {
                            continue;
                        }

                        OffsetVectors[] loadOffsets = new OffsetVectors[(int)BodyPart.BodyPartsCount];
                        loadOffsets[(int)BodyPart.WholeBody] = new OffsetVectors(new Vector3(characterOffsetParameters.PositionOffsetX, characterOffsetParameters.PositionOffsetY, characterOffsetParameters.PositionOffsetZ),
                                                                                 new Vector3(characterOffsetParameters.RotationOffsetP, characterOffsetParameters.RotationOffsetY, characterOffsetParameters.RotationOffsetR),
                                                                                 new Vector3(0, 0, 0));
                        loadOffsets[(int)BodyPart.LeftHand] = new OffsetVectors(new Vector3(characterOffsetParameters.LeftHandPositionOffsetX, characterOffsetParameters.LeftHandPositionOffsetY, characterOffsetParameters.LeftHandPositionOffsetZ),
                                                                                new Vector3(characterOffsetParameters.LeftHandRotationOffsetP, characterOffsetParameters.LeftHandRotationOffsetY, characterOffsetParameters.LeftHandRotationOffsetR),
                                                                                new Vector3(characterOffsetParameters.LeftHandHintPositionOffsetX, characterOffsetParameters.LeftHandHintPositionOffsetY, characterOffsetParameters.LeftHandHintPositionOffsetZ));
                        loadOffsets[(int)BodyPart.RightHand] = new OffsetVectors(new Vector3(characterOffsetParameters.RightHandPositionOffsetX, characterOffsetParameters.RightHandPositionOffsetY, characterOffsetParameters.RightHandPositionOffsetZ),
                                                                                 new Vector3(characterOffsetParameters.RightHandRotationOffsetP, characterOffsetParameters.RightHandRotationOffsetY, characterOffsetParameters.RightHandRotationOffsetR),
                                                                                 new Vector3(characterOffsetParameters.RightHandHintPositionOffsetX, characterOffsetParameters.RightHandHintPositionOffsetY, characterOffsetParameters.RightHandHintPositionOffsetZ));
                        loadOffsets[(int)BodyPart.LeftFoot] = new OffsetVectors(new Vector3(characterOffsetParameters.LeftFootPositionOffsetX, characterOffsetParameters.LeftFootPositionOffsetY, characterOffsetParameters.LeftFootPositionOffsetZ),
                                                                                new Vector3(characterOffsetParameters.LeftFootRotationOffsetP, characterOffsetParameters.LeftFootRotationOffsetY, characterOffsetParameters.LeftFootRotationOffsetR),
                                                                                new Vector3(characterOffsetParameters.LeftFootHintPositionOffsetX, characterOffsetParameters.LeftFootHintPositionOffsetY, characterOffsetParameters.LeftFootHintPositionOffsetZ));
                        loadOffsets[(int)BodyPart.RightFoot] = new OffsetVectors(new Vector3(characterOffsetParameters.RightFootPositionOffsetX, characterOffsetParameters.RightFootPositionOffsetY, characterOffsetParameters.RightFootPositionOffsetZ),
                                                                                 new Vector3(characterOffsetParameters.RightFootRotationOffsetP, characterOffsetParameters.RightFootRotationOffsetY, characterOffsetParameters.RightFootRotationOffsetR),
                                                                                 new Vector3(characterOffsetParameters.RightFootHintPositionOffsetX, characterOffsetParameters.RightFootHintPositionOffsetY, characterOffsetParameters.RightFootHintPositionOffsetZ));

                        SliderUI.LoadOffsets(charIndex, loadOffsets);

                        bValidOffsetsFound = true;
                    }

                    SliderUI.ApplyPositions();
                }
            }

            // if we didn't find offsets to apply, move the characters to their 0 position, in case they were moved out of it from another offset.
            if (!bValidOffsetsFound)
            {
                SliderUI.ResetPositions();
            }

            SliderUI.UpdateUIPositions();
        }
コード例 #11
0
        //-- Apply character offsets for current animation, if they can be found --//
        public static void ApplyCharacterOffsets()
        {
            var currentAnimation   = HS2_BetterHScenes.hFlagCtrl.nowAnimationInfo.nameAnimation;
            var bValidOffsetsFound = false;

            if (currentAnimation == null)
            {
                return;
            }

            if (HS2_BetterHScenes.currentMotion == null)
            {
                HS2_BetterHScenes.currentMotion = "default";
            }

            string characterGroupName = null;

            foreach (var character in HS2_BetterHScenes.characters.Where(character => character != null && character.visibleAll))
            {
                if (characterGroupName == null)
                {
                    characterGroupName = character.fileParam.fullname;
                }
                else
                {
                    characterGroupName += "_" + character.fileParam.fullname;
                }
            }

            if (characterGroupName != null)
            {
                var characterGroup = hSceneOffsets.CharacterGroupList.Find(x => x.CharacterGroupName == characterGroupName);
                if (characterGroup != null)
                {
                    for (var charIndex = 0; charIndex < HS2_BetterHScenes.characters.Count; charIndex++)
                    {
                        var character = characterGroup.CharacterList.Find(x => x.CharacterName == HS2_BetterHScenes.characters[charIndex].fileParam.fullname);
                        if (character == null)
                        {
                            continue;
                        }

                        var animation = character.AnimationList.Find(x => x.AnimationName == currentAnimation);
                        if (animation == null)
                        {
                            continue;
                        }

                        var motion = animation.MotionOffsetList.Find(x => x.MotionName == HS2_BetterHScenes.currentMotion);
                        if (HS2_BetterHScenes.useOneOffsetForAllMotions.Value || motion == null || motion.MotionName != HS2_BetterHScenes.currentMotion)
                        {
                            if (HS2_BetterHScenes.useUniqueOffsetForWeak.Value && HS2_BetterHScenes.currentMotion.StartsWith("D_"))
                            {
                                motion = animation.MotionOffsetList.Find(x => x.MotionName == "defaultWeak");
                            }
                            else
                            {
                                motion = animation.MotionOffsetList.Find(x => x.MotionName == "default");
                            }
                        }

                        if (motion == null)
                        {
                            continue;
                        }

                        OffsetVectors[] loadOffsets = new OffsetVectors[(int)BodyPart.BodyPartsCount];
                        loadOffsets[(int)BodyPart.WholeBody] = new OffsetVectors(new Vector3(motion.PositionOffsetX, motion.PositionOffsetY, motion.PositionOffsetZ),
                                                                                 new Vector3(motion.RotationOffsetP, motion.RotationOffsetY, motion.RotationOffsetR),
                                                                                 new Vector3(motion.HeadRotationOffsetP, motion.HeadRotationOffsetY, motion.HeadRotationOffsetR),
                                                                                 0f);
                        loadOffsets[(int)BodyPart.LeftHand] = new OffsetVectors(new Vector3(motion.LeftHandPositionOffsetX, motion.LeftHandPositionOffsetY, motion.LeftHandPositionOffsetZ),
                                                                                new Vector3(motion.LeftHandRotationOffsetP, motion.LeftHandRotationOffsetY, motion.LeftHandRotationOffsetR),
                                                                                new Vector3(motion.LeftHandHintPositionOffsetX, motion.LeftHandHintPositionOffsetY, motion.LeftHandHintPositionOffsetZ),
                                                                                motion.LeftHandDigitRotationOffsetZ);
                        loadOffsets[(int)BodyPart.RightHand] = new OffsetVectors(new Vector3(motion.RightHandPositionOffsetX, motion.RightHandPositionOffsetY, motion.RightHandPositionOffsetZ),
                                                                                 new Vector3(motion.RightHandRotationOffsetP, motion.RightHandRotationOffsetY, motion.RightHandRotationOffsetR),
                                                                                 new Vector3(motion.RightHandHintPositionOffsetX, motion.RightHandHintPositionOffsetY, motion.RightHandHintPositionOffsetZ),
                                                                                 motion.RightHandDigitRotationOffsetZ);
                        loadOffsets[(int)BodyPart.LeftFoot] = new OffsetVectors(new Vector3(motion.LeftFootPositionOffsetX, motion.LeftFootPositionOffsetY, motion.LeftFootPositionOffsetZ),
                                                                                new Vector3(motion.LeftFootRotationOffsetP, motion.LeftFootRotationOffsetY, motion.LeftFootRotationOffsetR),
                                                                                new Vector3(motion.LeftFootHintPositionOffsetX, motion.LeftFootHintPositionOffsetY, motion.LeftFootHintPositionOffsetZ),
                                                                                motion.LeftFootDigitRotationOffsetZ);
                        loadOffsets[(int)BodyPart.RightFoot] = new OffsetVectors(new Vector3(motion.RightFootPositionOffsetX, motion.RightFootPositionOffsetY, motion.RightFootPositionOffsetZ),
                                                                                 new Vector3(motion.RightFootRotationOffsetP, motion.RightFootRotationOffsetY, motion.RightFootRotationOffsetR),
                                                                                 new Vector3(motion.RightFootHintPositionOffsetX, motion.RightFootHintPositionOffsetY, motion.RightFootHintPositionOffsetZ),
                                                                                 motion.RightFootDigitRotationOffsetZ);

                        bool[] jointCorrections = new bool[(int)BodyPart.BodyPartsCount];
                        jointCorrections[(int)BodyPart.LeftHand]  = motion.LeftHandJointCorrection;
                        jointCorrections[(int)BodyPart.RightHand] = motion.RightHandJointCorrection;
                        jointCorrections[(int)BodyPart.LeftFoot]  = motion.LeftFootJointCorrection;
                        jointCorrections[(int)BodyPart.RightFoot] = motion.RightFootJointCorrection;

                        SliderUI.LoadOffsets(charIndex, loadOffsets, jointCorrections, character.ShoeOffset, character.MouthOffset);

                        bValidOffsetsFound = true;
                    }

                    SliderUI.ApplyPositionsAndCorrections();
                }
            }

            // if we didn't find offsets to apply, move the characters to their 0 position, in case they were moved out of it from another offset.
            if (!bValidOffsetsFound)
            {
                SliderUI.ResetPositions();
            }

            SliderUI.UpdateUIPositions();
        }