示例#1
0
        private static void CreateStudioControls()
        {
            var currentStateCategory = StudioAPI.GetOrCreateCurrentStateCategory(null);

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

            int ReadValue(OCIChar c)
            {
                var crest = c.GetChaControl().GetComponent <LewdCrestXController>().CurrentCrest;

                return(list.GetIndex(crest));
            }

            void SetValue(int i)
            {
                var crest = list.GetType(i);

                foreach (var controller in StudioAPI.GetSelectedControllers <LewdCrestXController>())
                {
                    controller.CurrentCrest = crest;
                }
            }

            currentStateCategory.AddControl(new CurrentStateCategoryDropdown("Lewd Crest", list.GetInterfaceNames(), ReadValue)).Value.Subscribe(SetValue);

            currentStateCategory.AddControl(new CurrentStateCategorySwitch("Lewd Crest visible",
                                                                           c => c.GetChaControl().GetComponent <LewdCrestXController>().HideCrestGraphic)).Value.Subscribe(
                b => StudioAPI.GetSelectedControllers <LewdCrestXController>().Do(ctrl => ctrl.HideCrestGraphic = b));
        }
示例#2
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)";
                    }
                });
            }
        }
示例#3
0
        public static CrestInterfaceList Create(bool onlyImplemented, bool separateImplemented)
        {
            IEnumerable <CrestInfo> infos = LewdCrestXPlugin.CrestInfos.Values.OrderByDescending(x => separateImplemented && x.Implemented).ThenBy(x => x.Name);

            if (onlyImplemented)
            {
                infos = infos.Where(x => x.Implemented);
            }
            var crestInfos = infos.ToList();
            var list       = new CrestInterfaceList();

            list._interfaceCrestTypes = new[] { CrestType.None }.Concat(crestInfos.Select(x => x.Id)).ToArray();
            list._interfaceCrestNames = new[] { "No crest" }.Concat(crestInfos.Select(x => !onlyImplemented && separateImplemented && x.Implemented ? "[+] " + x.Name : x.Name)).ToArray();
            crestInfos.Insert(0, null);
            list._interfaceCrestInfos = crestInfos.ToArray();
            return(list);
        }