Exemplo n.º 1
0
        private void MakerAPI_RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent ev)
        {
            MakerCategory category = new MakerCategory("03_ClothesTop", "tglSettings", MakerConstants.Clothes.Copy.Position + 1, "Settings");

            var label = new MakerText("Unlock bras with all tops, bottoms with all tops, and underwear with all bras", category, this);

            ev.AddControl(label);

            ClothingUnlockToggle = new MakerToggle(category, "Clothing Unlock", this);
            ev.AddControl(ClothingUnlockToggle);

            var observer = Observer.Create <bool>(value =>
            {
                if (MakerAPI.InsideAndLoaded)
                {
                    var chaControl        = MakerAPI.GetCharacterControl();
                    var controller        = GetController(chaControl);
                    bool clothingUnlocked = controller.GetClothingUnlocked();
                    if (clothingUnlocked != value)
                    {
                        controller.SetClothingUnlocked(value);
                        chaControl.Reload();
                    }
                }
            });

            ClothingUnlockToggle.ValueChanged.Subscribe(observer);

            ev.AddSubCategory(category);
        }
Exemplo n.º 2
0
            private static void RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent e)
            {
                MakerCategory category = MakerConstants.Body.All;

                Color[] textColors = { new Color(0.27843f, 1f, 1f), new Color(0.45f, 0.7f, 0.7f) };

                MakerToggle vrHeadSizeToggle = e.AddControl(new KKAPI.Maker.UI.MakerToggle(category, "Enable VR Head Size", Instance)
                {
                    TextColor = textColors[0]
                });

                vrHeadSizeToggle.BindToFunctionController <KK_VRHeadSizeAdjustController, bool>(
                    (controller) => controller._vrHeadSizeEnabled,
                    (controller, value) => controller._vrHeadSizeEnabled = value

                    );

                MakerText explanation = e.AddControl(new MakerText("Enable for different head size in VR. Can improve experience for characters with large heads, which tend to look like sports mascots.", category, Instance)
                {
                    TextColor = textColors[1]
                });


                MakerSlider vrHeadSizeSlider = e.AddControl(new MakerSlider(category, "VR Head Size", SliderUnlocker.SliderUnlocker.Minimum.Value / 100, SliderUnlocker.SliderUnlocker.Maximum.Value / 100, 0.6f, Instance)
                {
                    TextColor = textColors[0]
                });

                vrHeadSizeSlider.BindToFunctionController <KK_VRHeadSizeAdjustController, float>(
                    (controller) => controller._vrHeadSize,
                    (controller, value) => controller._vrHeadSize = value
                    );
            }
Exemplo n.º 3
0
 private void RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent e)
 {
     if (MakerAPI.GetMakerSex() == 0)
     {
         _toggleEnabled = e.AddControl(new MakerToggle(MakerConstants.Parameter.Character, "Character is a trap or a futa (changes gameplay)", this));
         _toggleEnabled.ValueChanged.Subscribe(val => GetMakerController().IsTrap = val);
     }
 }
Exemplo n.º 4
0
 private static void UpdateToggleSubscription(MakerToggle toggle, bool value, Action <bool> action)
 {
     toggle.ValueChanged.Subscribe(Observer.Create <bool>(b =>
     {
         action(b);
         _pushUpController.RecalculateBody(false);
     }));
     toggle.SetValue(value);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Register the custom controls
        /// </summary>
        /// <param name="s"></param>
        /// <param name="e"></param>
        private void MakerAPI_MakerBaseLoaded(object s, RegisterCustomControlsEvent e)
        {
#if KK || EC || KKS
            var category = MakerConstants.Face.Eye;
#else
            var category = MakerConstants.Face.Eyes;
#endif
            EyeOpenMaxSlider = e.AddControl(new MakerSlider(category, "Eye Open Max", 0, 1, 1, this));
            EyeOpenMaxSlider.ValueChanged.Subscribe(value => GetCharaController(MakerAPI.GetCharacterControl()).EyeOpenMax = value);
            DisableBlinkingToggle = e.AddControl(new MakerToggle(category, "Disable Character Blinking", this));
            DisableBlinkingToggle.ValueChanged.Subscribe(value => GetCharaController(MakerAPI.GetCharacterControl()).DisableBlinking = value);
        }
Exemplo n.º 6
0
        private static void RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent e)
        {
            if (MakerAPI.GetMakerSex() == 0)
            {
                var category = MakerConstants.Parameter.Character;

                _toggleEnabled = e.AddControl(new MakerToggle(category, "Character is a trap or a futa (changes gameplay)", BecomeTrap.Instance));
                _toggleEnabled.ValueChanged.Subscribe(val => GetMakerController().IsTrap = val);

                _animType = e.AddControl(new MakerDropdown("Idle trap animation", _idleAnimations.Select(x => x.Value).ToArray(), category, 0, BecomeTrap.Instance));
                _animType.ValueChanged.Subscribe(i => GetMakerController().IdleAnimation = _idleAnimations[i].Key);
            }
        }
Exemplo n.º 7
0
 private void MakerAPI_RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent e)
 {
     GooToggle = e.AddControl(new MakerToggle(MakerConstants.Body.All, "Goo", this));
     GooToggle.ValueChanged.Subscribe(Observer.Create <bool>(delegate { if (DoEvents)
                                                                        {
                                                                            GetController(MakerAPI.GetCharacterControl()).SetEnabled(GooToggle.Value);
                                                                        }
                                                             }));
     AlphaSlider = e.AddControl(new MakerSlider(MakerConstants.Body.All, "Alpha", 0.5f, 1f, 0.741f, this));
     AlphaSlider.ValueChanged.Subscribe(Observer.Create <float>(delegate { if (DoEvents)
                                                                           {
                                                                               GetController(MakerAPI.GetCharacterControl()).SetAlpha(AlphaSlider.Value);
                                                                           }
                                                                }));
 }
Exemplo n.º 8
0
        public void MakerAPI_RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent e)
        {
            float min = SliderMin.Value / 100f;
            float max = SliderMax.Value / 100f;


            // Boob

            foreach (string prefix in BoobController.prefixKeys)
            {
                foreach (string boolKey in BoobController.boolKeys)
                {
                    string      key    = prefix + boolKey;
                    MakerToggle toggle = toggles[key] = e.AddControl(new MakerToggle(
                                                                         categories[prefix],
                                                                         BoobController.makerAPILabels[key],
                                                                         BoobController.boolDefaults[key],
                                                                         this
                                                                         ));
                    toggle.ValueChanged.Subscribe(Observer.Create <bool>(v =>
                                                                         MakerAPI_ToggleValueChanged(key, v)
                                                                         ));
                }

                foreach (string floatKey in BoobController.floatKeys)
                {
                    string key          = prefix + floatKey;
                    float  defaultValue = BoobController.floatDefaults[key];

                    if (BoobController.floatMults.TryGetValue(floatKey, out float mult))
                    {
                        defaultValue *= mult;
                    }

                    MakerSlider slider = sliders[key] = e.AddControl(new MakerSlider(
                                                                         categories[prefix],
                                                                         BoobController.makerAPILabels[key],
                                                                         min,
                                                                         max,
                                                                         defaultValue,
                                                                         this
                                                                         ));
                    slider.ValueChanged.Subscribe(Observer.Create <float>(v =>
                                                                          MakerAPI_SliderValueChanged(prefix, floatKey, v)
                                                                          ));
                }
            }
        }
Exemplo n.º 9
0
        private static void RegisterMakerControls(object sender, RegisterSubCategoriesEvent e)
        {
            // Doesn't apply for male characters
            if (MakerAPI.GetMakerSex() == 0)
            {
                return;
            }

            var cat = MakerConstants.GetBuiltInCategory("05_ParameterTop", "tglH");

            _stretched = e.AddControl(new MakerToggle(cat, "Stretched hymen", false, _skinEffectsPlugin));
            _stretched.ValueChanged.Subscribe(b => GetMakerController().StretchedHymen = b);
            e.AddControl(new MakerText("Makes it much less likely that she will bleed during the first time.", cat, _skinEffectsPlugin)).TextColor = new Color(0.7f, 0.7f, 0.7f);
            _regen = e.AddControl(new MakerToggle(cat, "Hymen regenerates", false, _skinEffectsPlugin));
            _regen.ValueChanged.Subscribe(b => GetMakerController().HymenRegen = b);
            e.AddControl(new MakerText("The hymen grows back after a good night's sleep (to the state before sex).", cat, _skinEffectsPlugin)).TextColor = new Color(0.7f, 0.7f, 0.7f);
            _fragile = e.AddControl(new MakerToggle(cat, "Fragile v****a", false, _skinEffectsPlugin));
            _fragile.ValueChanged.Subscribe(b => GetMakerController().FragileVag = b);
            e.AddControl(new MakerText("When going at it very roughly has a chance to bleed, be gentle!", cat, _skinEffectsPlugin)).TextColor = new Color(0.7f, 0.7f, 0.7f);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Initializer for Favorites UI.
        /// </summary>
        internal UI()
        {
            KKAT_instance   = Singleton <KK_Archetypes> .Instance;
            showAdvancedGUI = false;
            showLoadGUI     = true;

            _selectStyle.normal.background = new Texture2D(1, 1);
            _selectStyle.normal.background.SetPixel(1, 1, new Color(1, 1, 1, .4f));
            _selectStyle.normal.background.Apply();
            _selectStyle.active.background  = _selectStyle.normal.background;
            _selectStyle.focused.background = _selectStyle.normal.background;
            _selectStyle.hover.background   = _selectStyle.normal.background;

            _normalStyle.normal.textColor  = Color.white;
            _normalStyle.active.textColor  = Color.white;
            _normalStyle.hover.textColor   = Color.white;
            _normalStyle.focused.textColor = Color.white;

            FavoritesSubCat = new MakerCategory(MakerConstants.Parameter.Character.CategoryName, "Archetypes");
            AllToggle       = new MakerToggle(FavoritesSubCat, "Select/Deselect All", KKAT_instance);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Register the futa checkbox with MakerAPI
        /// </summary>
        private void AddCategory(object sender, RegisterSubCategoriesEvent args)
        {
            if (Singleton <CustomBase> .Instance.modeSex == 0)
            {
                return;
            }

            FutaToggle = args.AddControl(new MakerToggle(MakerConstants.Body.All, "ふたなり", this));
            void ToggleFuta(bool IsFuta)
            {
                Singleton <CustomBase> .Instance.chaCtrl.chaFile.status.visibleSonAlways = IsFuta;
                PluginData ExtendedData = new PluginData();

                ExtendedData.data = new Dictionary <string, object> {
                    { "Futa", IsFuta }
                };
                ExtendedSave.SetExtendedDataById(Singleton <CustomBase> .Instance.chaCtrl.chaFile, "KK_FutaMod", ExtendedData);
            }

            var obs = Observer.Create <bool>(ToggleFuta);

            FutaToggle.ValueChanged.Subscribe(obs);
            FutaToggle.Value = Singleton <CustomBase> .Instance.chaCtrl.chaFile.status.visibleSonAlways;
        }
Exemplo n.º 12
0
 private void MakerAPI_RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent e)
 {
     InvisibleToggle = e.AddControl(new MakerToggle(MakerConstants.Body.All, "Invisible Body", false, this));
     InvisibleToggle.ValueChanged.Subscribe(Observer.Create <bool>(delegate { PluginBase.GetController(MakerAPI.GetCharacterControl()).Visible = !InvisibleToggle.Value; }));
 }
Exemplo n.º 13
0
        private void RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent ev)
        {
            MakerCategory category = new MakerCategory("03_ClothesTop", "tglPushup", MakerConstants.Clothes.Bra.Position + 1, "Pushup");

            //Bra or top
            SelectButtons = ev.AddControl(new MakerRadioButtons(category, this, "Type", "Bra", "Top"));
            SelectButtons.ValueChanged.Subscribe(i => ReloadPushup());

            //Basic mode
            EnablePushupToggle = new MakerToggle(category, "Enabled", true, this);
            ev.AddControl(EnablePushupToggle);

            FirmnessSlider     = MakeSlider(category, "Firmness", ev, ConfigFirmnessDefault.Value);
            LiftSlider         = MakeSlider(category, "Lift", ev, ConfigLiftDefault.Value);
            PushTogetherSlider = MakeSlider(category, "Push Together", ev, ConfigPushTogetherDefault.Value);
            SqueezeSlider      = MakeSlider(category, "Squeeze", ev, ConfigSqueezeDefault.Value);
            CenterSlider       = MakeSlider(category, "Center Nipples", ev, ConfigNippleCenteringDefault.Value);

            FlattenNippleToggle = new MakerToggle(category, "Flatten Nipples", true, this);
            ev.AddControl(FlattenNippleToggle);

            //Advanced mode
            ev.AddControl(new MakerSeparator(category, this));

            AdvancedModeToggle = new MakerToggle(category, "Advanced Mode", false, this);
            ev.AddControl(AdvancedModeToggle);

            var copyBodyButton = new MakerButton("Copy Body To Advanced", category, this);

            ev.AddControl(copyBodyButton);
            copyBodyButton.OnClick.AddListener(CopyBodyToSliders);

            var copyBasicButton = new MakerButton("Copy Basic To Advanced", category, this);

            ev.AddControl(copyBasicButton);
            copyBasicButton.OnClick.AddListener(CopyBasicToSliders);

            PushSizeSlider               = MakeSlider(category, "Size", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexSize], true);
            PushVerticalPositionSlider   = MakeSlider(category, "Vertical Position", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexVerticalPosition], true);
            PushHorizontalAngleSlider    = MakeSlider(category, "Horizontal Angle", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexHorizontalAngle], true);
            PushHorizontalPositionSlider = MakeSlider(category, "Horizontal Position", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexHorizontalPosition], true);
            PushVerticalAngleSlider      = MakeSlider(category, "Vertical Angle", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexVerticalAngle], true);
            PushDepthSlider              = MakeSlider(category, "Depth", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexDepth], true);
            PushRoundnessSlider          = MakeSlider(category, "Roundness", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexRoundness], true);

            PushSoftnessSlider = MakeSlider(category, "Softness", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.bustSoftness, true);
            PushWeightSlider   = MakeSlider(category, "Weight", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.bustWeight, true);

            PushAreolaDepthSlider = MakeSlider(category, "Areola Depth", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexAreolaDepth], true);
            PushNippleWidthSlider = MakeSlider(category, "Nipple Width", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexNippleWidth], true);
            PushNippleDepthSlider = MakeSlider(category, "Nipple Depth", ev, Singleton <CustomBase> .Instance.defChaInfo.custom.body.shapeValueBody[PushupConstants.IndexNippleDepth], true);

#if KK
            //Only one outfit in EC
            var coordinateList = Enum.GetNames(typeof(ChaFileDefine.CoordinateType)).ToList();
            coordinateList.Add("All");
            ev.AddControl(new MakerSeparator(category, this));
            var copyDropdown = new MakerDropdown("Copy To Coordinate", coordinateList.ToArray(), category, 0, this);
            ev.AddControl(copyDropdown);

            string[] DataTypes        = new string[] { "Basic and Advanced", "Basic", "Advanced" };
            var      copyDataDropdown = new MakerDropdown("Data To Copy", DataTypes, category, 0, this);
            ev.AddControl(copyDataDropdown);

            var copyButton = new MakerButton("Copy", category, this);
            ev.AddControl(copyButton);
            copyButton.OnClick.AddListener(delegate
            {
                bool copyBasic    = copyDataDropdown.Value == 0 || copyDataDropdown.Value == 1;
                bool copyAdvanced = copyDataDropdown.Value == 0 || copyDataDropdown.Value == 2;

                if (copyDropdown.Value == coordinateList.Count - 1) //Copy all
                {
                    for (int i = 0; i < coordinateList.Count - 1; i++)
                    {
                        CopySlidersToCoordinate(i, copyBasic, copyAdvanced);
                    }
                }
                else
                {
                    CopySlidersToCoordinate(copyDropdown.Value, copyBasic, copyAdvanced);
                }
            });
#endif
            ev.AddSubCategory(category);
        }
Exemplo n.º 14
0
 private static void MakerExiting(object sender, EventArgs e)
 {
     _stretched = null;
     _fragile   = null;
     _regen     = null;
 }
Exemplo n.º 15
0
 private static void MakerExiting(object sender, EventArgs e)
 {
     _toggleEnabled = null;
     _animType      = null;
 }
Exemplo n.º 16
0
        private void Start()
        {
            CharacterApi.RegisterExtraBehaviour <MaterialRouterController>(GUID);

            HooksInstance = Harmony.CreateAndPatchAll(typeof(Hooks));

            BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue("com.deathweasel.bepinex.materialeditor", out PluginInfo PluginInfo);
            Type MaterialEditorCharaController = PluginInfo.Instance.GetType().Assembly.GetType("KK_Plugins.MaterialEditor.MaterialEditorCharaController");

            HooksInstance.Patch(MaterialEditorCharaController.GetMethod("OnReload", AccessTools.all, null, new[] { typeof(GameMode), typeof(bool) }, null), prefix: new HarmonyMethod(typeof(Hooks), nameof(Hooks.MaterialEditorCharaController_OnReload_Prefix)));
            HooksInstance.Patch(MaterialEditorCharaController.GetMethod("OnCoordinateBeingLoaded", AccessTools.all, null, new[] { typeof(ChaFileCoordinate), typeof(bool) }, null), prefix: new HarmonyMethod(typeof(Hooks), nameof(Hooks.MaterialEditorCharaController_OnCoordinateBeingLoaded_Prefix)));
            HooksInstance.Patch(MaterialEditorCharaController.GetMethod("CorrectTongue", AccessTools.all, null, new Type[0], null), prefix: new HarmonyMethod(typeof(Hooks), nameof(Hooks.MaterialEditorCharaController_CorrectTongue_Prefix)));
            Type MaterialEditorMaterialAPI = PluginInfo.Instance.GetType().Assembly.GetType("MaterialEditorAPI.MaterialAPI");

            if (MaterialEditorMaterialAPI.GetMethods().Single(x => x.Name == "SetTexture").GetParameters().ElementAtOrDefault(3)?.ParameterType == typeof(Texture))
            {
                HooksInstance.Patch(MaterialEditorMaterialAPI.GetMethod("SetTexture", AccessTools.all, null, new[] { typeof(GameObject), typeof(string), typeof(string), typeof(Texture) }, null), prefix: new HarmonyMethod(typeof(Hooks), nameof(Hooks.MaterialAPI_SetTexture_Prefix)));
            }
            else
            {
                HooksInstance.Patch(MaterialEditorMaterialAPI.GetMethod("SetTexture", AccessTools.all, null, new[] { typeof(GameObject), typeof(string), typeof(string), typeof(Texture2D) }, null), prefix: new HarmonyMethod(typeof(Hooks), nameof(Hooks.MaterialAPI_SetTexture_Prefix)));
            }

            MakerAPI.MakerBaseLoaded += (object sender, RegisterCustomControlsEvent ev) =>
            {
                HooksMakerInstance = Harmony.CreateAndPatchAll(typeof(HooksMaker));
            };

            MakerAPI.MakerFinishedLoading += (object sender, EventArgs ev) =>
            {
                btmGetTemplate.Visible.OnNext(false);
                btmImportSetting.Visible.OnNext(false);
                btmRemoveSetting.Visible.OnNext(false);
            };

            AccessoriesApi.SelectedMakerAccSlotChanged += (object sender, AccessorySlotEventArgs ev) =>
            {
                InitCurrentSlot();
            };

            MakerAPI.MakerExiting += (object sender, EventArgs ev) =>
            {
                HooksMakerInstance.UnpatchAll(HooksMakerInstance.Id);
                HooksMakerInstance = null;
            };

            AccessoriesApi.AccessoryTransferred += (object sender, AccessoryTransferEventArgs ev) =>
            {
                MaterialRouterController pluginCtrl = GetController(MakerAPI.GetCharacterControl());
                pluginCtrl.AccessoryTransferEvent(ev);
            };

            AccessoriesApi.AccessoriesCopied += (object sender, AccessoryCopyEventArgs ev) =>
            {
                MaterialRouterController pluginCtrl = GetController(MakerAPI.GetCharacterControl());
                pluginCtrl.AccessoryCopyEvent(ev);
            };

            MakerAPI.RegisterCustomSubCategories += (object sender, RegisterSubCategoriesEvent ev) =>
            {
                ChaControl chaCtrl = MakerAPI.GetCharacterControl();
                MaterialRouterController pluginCtrl = GetController(chaCtrl);

                MakerCategory category = new MakerCategory("05_ParameterTop", "tglMaterialRouter", MakerConstants.Parameter.Attribute.Position + 1, "Router");
                ev.AddSubCategory(category);

                ev.AddControl(new MakerText("BodyTrigger", category, this));

                ev.AddControl(new MakerButton("Export", category, this)).OnClick.AddListener(delegate { pluginCtrl.ExportBodyTrigger(); });
                ev.AddControl(new MakerButton("Import", category, this)).OnClick.AddListener(delegate { pluginCtrl.ImportBodyTrigger(); });
                ev.AddControl(new MakerButton("Reset", category, this)).OnClick.AddListener(delegate { pluginCtrl.ResetBodyTrigger(); });

                ev.AddControl(new MakerSeparator(category, this));

                ev.AddControl(new MakerText("OutfitTriggers", category, this));

                ev.AddControl(new MakerButton("Export", category, this)).OnClick.AddListener(delegate { pluginCtrl.ExportOutfitTrigger(); });
                ev.AddControl(new MakerButton("Import", category, this)).OnClick.AddListener(delegate { pluginCtrl.ImportOutfitTrigger(); });
                ev.AddControl(new MakerButton("Reset", category, this)).OnClick.AddListener(delegate { pluginCtrl.ResetOutfitTrigger(); });

                ev.AddControl(new MakerSeparator(category, this));

                ev.AddControl(new MakerText("Config", category, this));

                tglSkipCloned = ev.AddControl(new MakerToggle(category, "Get Template Skip Cloned", CfgSkipCloned.Value, this));
                tglSkipCloned.ValueChanged.Subscribe(value => CfgSkipCloned.Value = value);

                ev.AddControl(new MakerSeparator(category, this));

                ev.AddControl(new MakerText("Tools", category, this));

                ev.AddControl(new MakerButton("Reload", category, Instance)).OnClick.AddListener(delegate
                {
                    string CardPath = Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(Paths.ExecutablePath) + "_MaterialRouter.png");
                    chaCtrl.chaFile.SaveCharaFile(CardPath, byte.MaxValue, false);

                    chaCtrl.chaFile.LoadFileLimited(CardPath);
                    if (chaCtrl.chaFile.GetLastErrorCode() != 0)
                    {
                        throw new Exception("LoadFileLimited failed");
                    }
                    chaCtrl.ChangeCoordinateType(true);
                    chaCtrl.Reload();
                    CustomBase.Instance.updateCustomUI = true;
                });

                ev.AddControl(new MakerButton("Info", category, Instance)).OnClick.AddListener(delegate
                {
                    Logger.LogInfo($"[BodyTrigger][{pluginCtrl?.BodyTrigger?.Count}]");
                    for (int i = 0; i < chaCtrl.chaFile.coordinate.Length; i++)
                    {
                        Logger.LogInfo($"[OutfitTriggers][{i}][{pluginCtrl?.OutfitTriggers?[i].Count}]");
                    }
                });

                ev.AddControl(new MakerButton("Head Get Template", MakerConstants.Face.All, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objHead, true));
                ev.AddControl(new MakerButton("Body Get Template", MakerConstants.Face.All, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objBody, true));

                const string labelConsolePrint    = "Console Output";
                const string labelGenerateSetting = "Generate Setting";
                const string labelRemoveSetting   = "Remove Setting";

                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.Top, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[0]));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.Bottom, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[1]));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.Bra, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[2]));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.Shorts, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[3]));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.Gloves, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[4]));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.Panst, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[5]));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.Socks, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[6]));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.InnerShoes, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[7]));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Clothes.OuterShoes, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objClothes[8]));

                btmGetTemplate = MakerAPI.AddAccessoryWindowControl(new MakerButton(labelConsolePrint, null, this));
                btmGetTemplate.OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.GetAccessoryObject(AccessoriesApi.SelectedMakerAccSlot)));
                btmImportSetting = MakerAPI.AddAccessoryWindowControl(new MakerButton(labelGenerateSetting, null, this));
                btmImportSetting.OnClick.AddListener(() => pluginCtrl.ImportFromRendererInfo(AccessoriesApi.SelectedMakerAccSlot));
                btmRemoveSetting = MakerAPI.AddAccessoryWindowControl(new MakerButton(labelRemoveSetting, null, this));
                btmRemoveSetting.OnClick.AddListener(() => pluginCtrl.RemoveAccSlotInfo(AccessoriesApi.SelectedMakerAccSlot));

                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Hair.Back, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objHair[0], true));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Hair.Front, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objHair[1], true));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Hair.Side, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objHair[2], true));
                ev.AddControl(new MakerButton(labelConsolePrint, MakerConstants.Hair.Extension, this)).OnClick.AddListener(() => PrintRendererInfo(chaCtrl, chaCtrl.objHair[3], true));
            };
        }
Exemplo n.º 17
0
        private void RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent args)
        {
            ChaControl _chaCtrl = CustomBase.Instance.chaCtrl;
            CharacterAccessoryController _pluginCtrl = GetController(_chaCtrl);

            SidebarToggleEnable = args.AddSidebarControl(new SidebarToggle("CharaAcc", CfgMakerMasterSwitch.Value, this));
            SidebarToggleEnable.ValueChanged.Subscribe(value => CfgMakerMasterSwitch.Value = value);

            MakerCategory category = new MakerCategory("03_ClothesTop", "tglCharaAcc", MakerConstants.Clothes.Copy.Position + 1, "CharaAcc");

            args.AddSubCategory(category);

            args.AddControl(new MakerText("The set to be used as a template to clone on load", category, this));

            List <string> coordinateList = Enum.GetNames(typeof(ChaFileDefine.CoordinateType)).ToList();

            coordinateList.Add("CharaAcc");
            MakerDropdownRef = new MakerDropdown("Referral", coordinateList.ToArray(), category, 0, this);
            MakerDropdownRef.ValueChanged.Subscribe(value =>
            {
                _pluginCtrl.SetReferralIndex(value);
            });
            args.AddControl(MakerDropdownRef);

            MakerToggleEnable = args.AddControl(new MakerToggle(category, "Enable", false, this));
            MakerToggleEnable.ValueChanged.Subscribe(value =>
            {
                _pluginCtrl.FunctionEnable = value;
            });

            MakerToggleAutoCopyToBlank = args.AddControl(new MakerToggle(category, "Auto Copy To Blank", false, this));
            MakerToggleAutoCopyToBlank.ValueChanged.Subscribe(value =>
            {
                _pluginCtrl.AutoCopyToBlank = value;
            });

            args.AddControl(new MakerButton("Backup", category, this)).OnClick.AddListener(delegate
            {
                if (_pluginCtrl.DuringLoading)
                {
                    return;
                }
                _pluginCtrl.Backup();
            });

            args.AddControl(new MakerButton("Restore", category, this)).OnClick.AddListener(delegate
            {
                if (_pluginCtrl.DuringLoading)
                {
                    return;
                }
                if (MoreAccessoriesSupport.ListUsedPartsInfo(_chaCtrl, _chaCtrl.fileStatus.coordinateType).Count > 0)
                {
                    Logger.LogMessage("Please clear the accessories on current coordinate before using this function");
                    return;
                }
                _pluginCtrl.TaskLock();
                _pluginCtrl.RestorePartsInfo();
            });

            args.AddControl(new MakerButton("Reset", category, this)).OnClick.AddListener(delegate
            {
                if (_pluginCtrl.DuringLoading)
                {
                    return;
                }
                _pluginCtrl.Reset();
                MakerDropdownRef.Value           = _pluginCtrl.ReferralIndex;
                MakerToggleEnable.Value          = _pluginCtrl.FunctionEnable;
                MakerToggleAutoCopyToBlank.Value = _pluginCtrl.AutoCopyToBlank;
            });
#if DEBUG
            args.AddControl(new MakerButton("Transfer", category, this)).OnClick.AddListener(delegate
            {
                if (_pluginCtrl.DuringLoading)
                {
                    return;
                }
                if (_pluginCtrl.ReferralIndex > 6)
                {
                    Logger.LogMessage("Please choose a coordinate other than CharaAcc as referral");
                    return;
                }
                _pluginCtrl.TaskLock();
                _pluginCtrl.PrepareQueue();
            });

            args.AddControl(new MakerButton("Hair info (local)", category, this)).OnClick.AddListener(delegate
            {
                _pluginCtrl.HairAccessoryCustomizer.DumpInfo(true);
            });

            args.AddControl(new MakerButton("Hair info", category, this)).OnClick.AddListener(delegate
            {
                _pluginCtrl.HairAccessoryCustomizer.DumpInfo(false);
            });
#endif
        }