コード例 #1
0
ファイル: SliderUI.cs プロジェクト: Animal42069/BetterHScenes
        private static void DeleteCurrentPositionOffsets()
        {
            List <string> characterNames = new List <string>();

            for (var charIndex = 0; charIndex < HS2_BetterHScenes.characters.Count; charIndex++)
            {
                if (!HS2_BetterHScenes.characters[charIndex].visibleAll)
                {
                    continue;
                }

                characterNames.Add(HS2_BetterHScenes.characters[charIndex].fileParam.fullname);
            }

            HSceneOffset.DeleteCharacterGroupOffsets(characterNames);

            ResetPositions();
        }
コード例 #2
0
        private static void SavePosition(bool bAsDefault = false)
        {
            List <string>          characterNames       = new List <string>();
            List <OffsetVectors[]> offsetsList          = new List <OffsetVectors[]>();
            List <float>           shoeOffsetList       = new List <float>();
            List <bool[]>          jointCorrectionsList = new List <bool[]>();

            for (var charIndex = 0; charIndex < HS2_BetterHScenes.characters.Count; charIndex++)
            {
                if (!HS2_BetterHScenes.characters[charIndex].visibleAll)
                {
                    continue;
                }

                characterNames.Add(HS2_BetterHScenes.characters[charIndex].fileParam.fullname);
                offsetsList.Add(characterOffsets[charIndex].offsetVectors);
                jointCorrectionsList.Add(characterOffsets[charIndex].jointCorrection);
                shoeOffsetList.Add(shoeOffsets[charIndex]);
            }

            HSceneOffset.SaveCharacterGroupOffsets(characterNames, offsetsList, jointCorrectionsList, shoeOffsetList, bAsDefault);
        }
コード例 #3
0
        private static void SavePosition(bool bAsDefault = false)
        {
            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;
                }
            }

            if (characterPairName == null)
            {
                return;
            }

            var characterPair = new CharacterPairList(characterPairName);

            for (var charIndex = 0; charIndex < HS2_BetterHScenes.characters.Count; charIndex++)
            {
                if (!HS2_BetterHScenes.characters[charIndex].visibleAll)
                {
                    continue;
                }

                var characterName         = HS2_BetterHScenes.characters[charIndex].fileParam.fullname;
                var characterOffsetParams = new CharacterOffsets(characterName, characterOffsets[charIndex].offsetVectors);

                characterPair.AddCharacterOffset(characterOffsetParams);
            }

            HSceneOffset.SaveCharacterPairPosition(characterPair, bAsDefault);
        }
コード例 #4
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;
                }
            }
        }
コード例 #5
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;
        }
コード例 #6
0
ファイル: SliderUI.cs プロジェクト: Animal42069/BetterHScenes
        private static void DrawWindow(int id)
        {
            GUIStyle lineStyle = new GUIStyle("box");

            lineStyle.border.top  = lineStyle.border.bottom = 1;
            lineStyle.margin.top  = lineStyle.margin.bottom = 1;
            lineStyle.padding.top = lineStyle.padding.bottom = 1;

            GUIStyle gridStyle = new GUIStyle("Button");

            gridStyle.onNormal.background = Texture2D.whiteTexture;
            gridStyle.onNormal.textColor  = Color.black;
            gridStyle.onHover.background  = Texture2D.whiteTexture;
            gridStyle.onHover.textColor   = Color.black;
            gridStyle.onActive.background = Texture2D.whiteTexture;
            gridStyle.onActive.textColor  = Color.black;

            string[] characterNames = new string[HS2_BetterHScenes.characters.Count];
            string[] offsetNames    = new string[] { "Whole Body", "Left Hand", "Right Hand", "Left Foot", "Right Foot" };
            for (var charIndex = 0; charIndex < HS2_BetterHScenes.characters.Count; charIndex++)
            {
                characterNames[charIndex] = HS2_BetterHScenes.characters[charIndex].fileParam.fullname;
            }

            using (GUILayout.VerticalScope guiVerticalScope = new GUILayout.VerticalScope("box"))
            {
                selectedCharacter = GUILayout.SelectionGrid(selectedCharacter, characterNames, HS2_BetterHScenes.characters.Count, gridStyle, GUILayout.Height(30));
                GUILayout.Box(GUIContent.none, lineStyle, GUILayout.ExpandWidth(true), GUILayout.Height(1f));
                using (GUILayout.HorizontalScope linkScope = new GUILayout.HorizontalScope("box"))
                {
                    selectedOffset = GUILayout.SelectionGrid(selectedOffset, offsetNames, offsetNames.Length, gridStyle, GUILayout.Height(30));
                }
                using (GUILayout.HorizontalScope linkScope = new GUILayout.HorizontalScope("box"))
                {
                    if (selectedOffset == (int)BodyPart.WholeBody)
                    {
                        GUILayout.Label("Mouth Size: ", GUILayout.Width((2 * uiWidth / 15) - 10));
                        mouthOffsets[selectedCharacter] = GUILayout.HorizontalSlider(mouthOffsets[selectedCharacter], -1, 1, GUILayout.Width((4 * uiWidth / 15) - 10));

                        GUILayout.FlexibleSpace();

                        GUILayout.Label("Heel Offset: ", GUILayout.Width((2 * uiWidth / 15) - 10));
                        shoeOffsets[selectedCharacter] = Convert.ToSingle(GUILayout.TextField(shoeOffsets[selectedCharacter].ToString("0.000"), GUILayout.Width((2 * uiWidth / 15) - 10)));
                    }
                    else
                    {
                        if (GUILayout.Button("Mirror Limb"))
                        {
                            MirrorActiveLimb();
                        }

                        bool[] lastCorrection = new bool[(int)BodyPart.BodyPartsCount];
                        for (var part = (int)BodyPart.LeftHand; part < (int)BodyPart.BodyPartsCount; part++)
                        {
                            lastCorrection[part] = characterOffsets[selectedCharacter].jointCorrection[part];
                        }

                        characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftHand] =
                            GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftHand], " Correction");
                        characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightHand] =
                            GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightHand], " Correction");
                        characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftFoot] =
                            GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftFoot], " Correction");
                        characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightFoot] =
                            GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightFoot], " Correction");

                        bool correctionChanged = false;
                        for (var part = (int)BodyPart.LeftHand; part < (int)BodyPart.BodyPartsCount; part++)
                        {
                            if (lastCorrection[part] == characterOffsets[selectedCharacter].jointCorrection[part])
                            {
                                continue;
                            }

                            correctionChanged = true;
                            break;
                        }

                        if (correctionChanged)
                        {
                            characterOffsets[selectedCharacter].ApplyJointCorrections();
                        }
                    }
                }

                GUILayout.Box(GUIContent.none, lineStyle, GUILayout.ExpandWidth(true), GUILayout.Height(1f));

                string  LabelName         = "Hint";
                float   sliderMaxHint     = HS2_BetterHScenes.sliderMaxHintPosition.Value;
                float   sliderMaxRotation = HS2_BetterHScenes.sliderMaxLimbRotation.Value;
                float   sliderMaxPosition = HS2_BetterHScenes.sliderMaxLimbPosition.Value;
                Vector3 lastPosition      = Vector3.zero;
                Vector3 lastRotation      = Vector3.zero;

                if (selectedOffset == (int)BodyPart.WholeBody)
                {
                    LabelName         = "Head Rotation";
                    sliderMaxHint     = HS2_BetterHScenes.sliderMaxBodyRotation.Value;
                    sliderMaxRotation = HS2_BetterHScenes.sliderMaxBodyRotation.Value;
                    sliderMaxPosition = HS2_BetterHScenes.sliderMaxBodyPosition.Value;
                    lastPosition      = new Vector3(
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x,
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y,
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z);
                    lastRotation = new Vector3(
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x,
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y,
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z);
                }

                using (GUILayout.HorizontalScope positionScope = new GUILayout.HorizontalScope("box"))
                {
                    using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Position X");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x, -sliderMaxPosition, sliderMaxPosition);
                    }

                    using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Position Y");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y, -sliderMaxPosition, sliderMaxPosition);
                    }

                    using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Position Z");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z, -sliderMaxPosition, sliderMaxPosition);
                    }
                }

                using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
                {
                    using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Rotation X");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x, -sliderMaxRotation, sliderMaxRotation);
                    }

                    using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Rotation Y");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y, -sliderMaxRotation, sliderMaxRotation);
                    }

                    using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Rotation Z");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z, -sliderMaxRotation, sliderMaxRotation);
                    }
                }

                using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
                {
                    using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label($"{LabelName} X");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x, -sliderMaxHint, sliderMaxHint);
                    }

                    using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label($"{LabelName} Y");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y, -sliderMaxHint, sliderMaxHint);
                    }

                    using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label($"{LabelName} Z");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z =
                            GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z, -sliderMaxHint, sliderMaxHint);
                    }
                }

                if (selectedOffset != (int)BodyPart.WholeBody)
                {
                    if (selectedOffset <= (int)BodyPart.RightHand)
                    {
                        sliderMaxRotation /= 4;
                    }

                    using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
                    {
                        GUILayout.FlexibleSpace();

                        using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
                        {
                            using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
                            {
                                GUILayout.Label($"Digit Rotation");

                                if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                                {
                                    characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation = 0;
                                }
                            }

                            characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation =
                                GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation, -sliderMaxRotation, sliderMaxRotation);
                        }

                        GUILayout.FlexibleSpace();
                    }
                }

                if (selectedOffset == (int)BodyPart.WholeBody &&
                    (lastPosition != characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position ||
                     lastRotation != characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation))
                {
                    ApplyPositionsAndCorrections();
                }

                using (GUILayout.HorizontalScope controlScope = new GUILayout.HorizontalScope("box"))
                {
                    if (GUILayout.Button("Copy"))
                    {
                        CopyPositions();
                    }

                    if (GUILayout.Button("Paste"))
                    {
                        PastePositions();
                    }

                    if (GUILayout.Button("Reset All"))
                    {
                        ResetPositions();
                    }

                    if (GUILayout.Button("Reload"))
                    {
                        HSceneOffset.ApplyCharacterOffsets();
                    }

                    if (HS2_BetterHScenes.useOneOffsetForAllMotions.Value == false && GUILayout.Button("Save This"))
                    {
                        SavePosition(false);
                    }

                    if (GUILayout.Button(HS2_BetterHScenes.useUniqueOffsetForWeak.Value && HS2_BetterHScenes.currentMotion.StartsWith("D_") ? "Save Weak" : "Save Default"))
                    {
                        SavePosition(true);
                    }

                    if (GUILayout.Button("Delete All"))
                    {
                        HS2_BetterHScenes.activeConfirmDeleteUI = true;
                    }
                }
            }

            GUI.DragWindow();
        }
コード例 #7
0
        private static void DrawWindow(int id)
        {
            GUIStyle lineStyle = new GUIStyle("box");

            lineStyle.border.top  = lineStyle.border.bottom = 1;
            lineStyle.margin.top  = lineStyle.margin.bottom = 1;
            lineStyle.padding.top = lineStyle.padding.bottom = 1;

            GUIStyle gridStyle = new GUIStyle("Button");

            gridStyle.onNormal.background = Texture2D.whiteTexture;
            gridStyle.onNormal.textColor  = Color.black;
            gridStyle.onHover.background  = Texture2D.whiteTexture;
            gridStyle.onHover.textColor   = Color.black;
            gridStyle.onActive.background = Texture2D.whiteTexture;
            gridStyle.onActive.textColor  = Color.black;

            string[] characterNames = new string[HS2_BetterHScenes.characters.Count];
            string[] offsetNames    = new string[] { "Whole Body", "Left Hand", "Right Hand", "Left Foot", "Right Foot" };
            for (var charIndex = 0; charIndex < HS2_BetterHScenes.characters.Count; charIndex++)
            {
                characterNames[charIndex] = HS2_BetterHScenes.characters[charIndex].fileParam.fullname;
            }

            using (GUILayout.VerticalScope guiVerticalScope = new GUILayout.VerticalScope("box"))
            {
                selectedCharacter = GUILayout.SelectionGrid(selectedCharacter, characterNames, HS2_BetterHScenes.characters.Count, gridStyle, GUILayout.Height(30));
                GUILayout.Box(GUIContent.none, lineStyle, GUILayout.ExpandWidth(true), GUILayout.Height(1f));
                selectedOffset = GUILayout.SelectionGrid(selectedOffset, offsetNames, offsetNames.Length, gridStyle, GUILayout.Height(30));
                using (GUILayout.HorizontalScope linkScope = new GUILayout.HorizontalScope("box"))
                {
                    GUILayout.Space((uiWidth / 5) - 10);
                    if (GUILayout.Button("Mirror Active Limb"))
                    {
                        MirrorActiveLimb();
                    }
                }

                GUILayout.Box(GUIContent.none, lineStyle, GUILayout.ExpandWidth(true), GUILayout.Height(1f));

                float sliderMaxRotation = HS2_BetterHScenes.sliderMaxRotation.Value;
                float sliderMaxPosition = HS2_BetterHScenes.sliderMaxPosition.Value;
                if (selectedOffset != 0)
                {
                    sliderMaxRotation *= 2;
                    sliderMaxPosition /= 2;
                }

                Vector3 lastPosition = new Vector3(0, 0, 0);
                Vector3 lastRotation = new Vector3(0, 0, 0);
                if (selectedOffset == (int)BodyPart.WholeBody)
                {
                    lastPosition = new Vector3(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x, characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y, characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z);
                    lastRotation = new Vector3(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x, characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y, characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z);
                }

                using (GUILayout.HorizontalScope positionScope = new GUILayout.HorizontalScope("box"))
                {
                    using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Position X");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x, -sliderMaxPosition, sliderMaxPosition);
                    }

                    using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Position Y");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y, -sliderMaxPosition, sliderMaxPosition);
                    }

                    using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Position Z");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z, -sliderMaxPosition, sliderMaxPosition);
                    }
                }

                using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
                {
                    using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Rotation X");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x, -sliderMaxRotation, sliderMaxRotation);
                    }

                    using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Rotation Y");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y, -sliderMaxRotation, sliderMaxRotation);
                    }

                    using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
                    {
                        using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Rotation Z");

                            if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                            {
                                characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z = 0;
                            }
                        }
                        characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z, -sliderMaxRotation, sliderMaxRotation);
                    }
                }

                if (selectedOffset != (int)BodyPart.WholeBody)
                {
                    using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
                    {
                        using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
                        {
                            using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
                            {
                                GUILayout.Label("Hint X");

                                if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                                {
                                    characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.x = 0;
                                }
                            }
                            characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.x = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.x, -sliderMaxPosition, sliderMaxPosition);
                        }

                        using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
                        {
                            using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
                            {
                                GUILayout.Label("Hint Y");

                                if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                                {
                                    characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.y = 0;
                                }
                            }
                            characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.y = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.y, -sliderMaxPosition, sliderMaxPosition);
                        }

                        using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
                        {
                            using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
                            {
                                GUILayout.Label("Hint Z");

                                if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
                                {
                                    characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.z = 0;
                                }
                            }
                            characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.z = GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hintPosition.z, -sliderMaxPosition, sliderMaxPosition);
                        }
                    }
                }
                else
                {
                    if (lastPosition != characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position || lastRotation != characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation)
                    {
                        ApplyPositions();
                    }
                }

                using (GUILayout.HorizontalScope controlScope = new GUILayout.HorizontalScope("box"))
                {
                    if (GUILayout.Button("Copy"))
                    {
                        CopyPositions();
                    }

                    if (GUILayout.Button("Paste"))
                    {
                        PastePositions();
                    }

                    if (GUILayout.Button("Reset All"))
                    {
                        ResetPositions();
                    }

                    if (GUILayout.Button("Reload"))
                    {
                        HSceneOffset.ApplyCharacterOffsets();
                    }

                    if (GUILayout.Button("Save This"))
                    {
                        SavePosition(HS2_BetterHScenes.useOneOffsetForAllMotions.Value);
                    }

                    if (HS2_BetterHScenes.useOneOffsetForAllMotions.Value == false && GUILayout.Button("Save Default"))
                    {
                        SavePosition(true);
                    }
                }
            }

            GUI.DragWindow();
        }