Ejemplo n.º 1
0
        private void MakerAPI_RegisterCustomSubCategories(object sender, RegisterSubCategoriesEvent e)
        {
            var category = new MakerCategory(MakerConstants.Parameter.ADK.CategoryName, "Crest");

            e.AddSubCategory(category);

            if (!_confUnlockStoryMaker.Value && MakerAPI.IsInsideClassMaker())
            {
                _descTxtControl = e.AddControl(new MakerText(
                                                   "To change crests inside story mode you have to invite the character to the club and use the crest icon in clubroom. You can also disable this limitation in plugin settings.",
                                                   category, this));
            }
            else
            {
                e.AddControl(new MakerText("Crests with the [+] tag will change gameplay in story mode.", category, this)
                {
                    TextColor = MakerText.ExplanationGray
                });

                var list = CrestInterfaceList.Create(false, true);

                var dropdownControl = e.AddControl(new MakerDropdown("Crest type", list.GetInterfaceNames(), category, 0, this));
                dropdownControl.BindToFunctionController <LewdCrestXController, int>(
                    controller => list.GetIndex(controller.CurrentCrest),
                    (controller, value) => controller.CurrentCrest = list.GetType(value));

                e.AddControl(new MakerToggle(category, "Hide crest graphic", this))
                .BindToFunctionController <LewdCrestXController, bool>(controller => controller.HideCrestGraphic, (controller, value) => controller.HideCrestGraphic = value);

                _descTxtControl = e.AddControl(new MakerText("Description", category, this));
                var implementedTxtControl = e.AddControl(new MakerText("", category, this));
                e.AddControl(new MakerText("The crests were created by novaksus on pixiv", category, this)
                {
                    TextColor = MakerText.ExplanationGray
                });
                dropdownControl.ValueChanged.Subscribe(value =>
                {
                    if (value <= 0)
                    {
                        _descTxtControl.Text       = "No crest selected, no effects applied";
                        implementedTxtControl.Text = "";
                    }
                    else
                    {
                        var crestInfo              = list.GetInfo(value);
                        _descTxtControl.Text       = crestInfo.Description;
                        implementedTxtControl.Text = crestInfo.Implemented
                            ? "This crest will affect gameplay in story mode as described"
                            : "This crest is only for looks (it might be implemented in the future with modified lore)";
                    }
                });
            }
        }