private void create_menu()
        {
            options = ModOptions.LoadCharacterSettings(this, Constants.SaveFolderName);
            IModSettingsFramework.Instance.AddModOptions(options);

            var list = new ModSelectionOptionChoices
            {
                { "default", this.Helper.Translation.Get("default") },
                { "v02", this.Helper.Translation.Get("v02") },
                { "v02a", this.Helper.Translation.Get("v02a") },
                { "v02b", this.Helper.Translation.Get("v02b") },
                { "v02c", this.Helper.Translation.Get("v02c") }
            };

            this.DropDown = options.GetOptionWithIdentifier <ModOptionSelection>("bundle") ?? new ModOptionSelection("bundle", "Bundels", list);
            options.AddModOption(this.DropDown);

            this.DropDown.hoverTextDictionary = new Dictionary <string, string>
            {
                { "default", this.Helper.Translation.Get("default.desc") },
                { "v02", this.Helper.Translation.Get("v02.desc") },
                { "v02a", this.Helper.Translation.Get("v02a.desc") },
                { "v02b", this.Helper.Translation.Get("v02b.desc") },
                { "v02c", this.Helper.Translation.Get("v02c.desc") }
            };

            saveButton = new ModOptionTrigger("okButton", this.Helper.Translation.Get("okButton"), OptionActionType.OK);
            options.AddModOption(saveButton);

            saveButton.ActionTriggered += id =>
            {
                this.Monitor.Log("[CCBO] Changing Bundle ...");

                options.SaveCharacterSettings(Constants.SaveFolderName);

                this.Monitor.Log(this.Helper.Translation.Locale);

                InvalidateCache(this.Helper);
                Game1.addHUDMessage(new HUDMessage("Changed Community Center Bundle to: " + this.DropDown.Selection, 3)
                {
                    noIcon = true, timeLeft = HUDMessage.defaultTime
                });
                this.Monitor.Log("[CCBO] Bundle changed successfully. If smth. is missing, you must restart your game.");
            };
        }
Пример #2
0
        private void GenerateOptions(ModOptions options, ModConfig config)
        {
            var enableDrop = new ModOptionToggle("toggle", "Checkbox", config.enableDropdown);

            options.AddModOption(enableDrop);

            enableDrop.ValueChanged += DisableDrop_ValueChanged;

            var choices = new ModSelectionOptionChoices();

            choices.Add("toggle", "Toggle");
            choices.Add("on", "Always On");
            choices.Add("off", "Always Off");

            dropdown = new ModOptionSelection("drop", "Dropdown", choices, config.dropdownChoice, config.enableDropdown)
            {
                hoverTextDictionary = new Dictionary <string, string>
                {
                    { "on", "Hover text for Always On" },
                    { "off", "Hover text for Always Off" }
                }
            };

            options.AddModOption(dropdown);

            dropdown.ValueChanged += Dropdown_ValueChanged;

            var checkbox2 = new ModOptionToggle("toggle2", "Checkbox2", config.checkbox2);

            options.AddModOption(checkbox2);

            options.AddModOption(new ModOptionToggle("toggle3", "Always On", false));

            var slider = new ModOptionRange("range", "Slider", 10, 25, 1, config.rangeValue, true);

            var stepper = new ModOptionStepper("stepper", "Plus/Minus Controls", (decimal)5.0, (decimal)105.0, (decimal)1.5, config.stepperValue, DisplayType.PERCENT);

            options.AddModOption(slider);
            options.AddModOption(stepper);

            options.AddModOption(new ModOptionToggle("stepperCheck", "Show Stepper Value", false));

            options.AddModOption(new ModOptionToggle("toggle5", "Checkbox5"));
            options.AddModOption(new ModOptionToggle("toggle6", "Checkbox6"));
            options.AddModOption(new ModOptionToggle("toggle7", "Checkbox7"));
            options.AddModOption(new ModOptionToggle("toggle8", "Checkbox8"));

            var saveButton = new ModOptionTrigger("okButton", "OK Button", OptionActionType.OK);

            options.AddModOption(saveButton);

            saveButton.ActionTriggered += (id) => {
                config.dropdownChoice = dropdown.Selection;
                config.enableDropdown = enableDrop.IsOn;
                this.Helper.WriteConfig <ModConfig>(config);
            };

            GraphicsEvents.OnPostRenderEvent += (sender, e) => {
                if (dropdown.Selection == "off")
                {
                    checkbox2.IsOn = false;
                }
                if (dropdown.Selection == "on" || (options.GetOptionWithIdentifier("toggle3") as ModOptionToggle).IsOn)
                {
                    Game1.spriteBatch.DrawString(Game1.dialogueFont, dropdown.Choices.LabelOf("on"), new Vector2(Game1.getMouseX(), Game1.getMouseY()), Color.Black);
                }
                if (toggledOn)
                {
                    Game1.spriteBatch.DrawString(Game1.dialogueFont, dropdown.Choices.LabelOf("toggle"), new Vector2(Game1.getMouseX(), Game1.getMouseY() + 12 * Game1.pixelZoom), Color.Black);
                }

                if ((options.GetOptionWithIdentifier("stepperCheck") as ModOptionToggle).IsOn)
                {
                    Game1.spriteBatch.DrawString(Game1.dialogueFont, stepper.Value.ToString(), new Vector2(Game1.getMouseX(), Game1.getMouseY() + 12 * Game1.pixelZoom), Color.Black);
                }
            };
        }
Пример #3
0
 /*********
 ** Public methods
 *********/
 public BundleEditor(IModHelper helper, IMonitor monitor, ModOptionSelection dropDown)
 {
     this.Helper   = helper;
     this.Monitor  = monitor;
     this.DropDown = dropDown;
 }
Пример #4
0
 public ModDropDownComponent(ModOptionSelection option, int width, int x, int y) : base(option.LabelText, width, x, y)
 {
     this.ModData = option;
 }
Пример #5
0
 public ModDropDownComponent(ModOptionSelection option, int width) : this(option, width, 0, 0)
 {
 }