Ice_Box_Studio_Sunkenland-ModSettingsMenu icon

ModSettingsMenu

Adds a Mod Settings button below Settings in the main menu and to the in-game pause menu, providing a unified configuration interface for mods.

Last updated 5 days ago
Total downloads 119
Total rating 0 
Categories Mods
Dependency string Ice_Box_Studio_Sunkenland-ModSettingsMenu-1.3.0
Dependants 3 other packages depend on this package

This mod requires the following mods to function

SunkenlandModding-BepInExPack_Sunkenland-5.4.22 icon
SunkenlandModding-BepInExPack_Sunkenland

BepInEx pack for Sunkenland. Preconfigured and does not need to include unstripped Unity DLLs. Sunkenland appears to be unstripped already.

Preferred version: 5.4.22
Ice_Box_Studio_Sunkenland-SunkenlandLocalizationAPI-1.2.0 icon
Ice_Box_Studio_Sunkenland-SunkenlandLocalizationAPI

Sunkenland Localization API is a shared localization library for Sunkenland BepInEx mods.

Preferred version: 1.2.0

README

Note: This description is bilingual. The Chinese section is provided below the English section.
说明:本描述为中英双语版本,中文内容位于英文内容下方。


Mod Settings Menu (English)

Adds a Mod Settings button below Settings in the main menu and to the in-game pause menu, providing a unified configuration interface for mods.

Main Features

  • Shows configurable mod names on the left and the selected mod's settings on the right.
  • Lets mod authors optionally register a display name, description, author, version, Nexus Mods ID, and Thunderstore package.

For Players

This mod does not change gameplay by itself. It provides a common settings screen for compatible mods. Only loaded mods with at least one configuration entry appear in the list. The available settings depend on the mods you have installed.

Mod Author API

  • Registration is optional. A loaded BepInEx plugin with normal Config.Bind entries is detected automatically.
  • Use ModSettingsRegistry.Register only when you want to provide custom metadata or Nexus Mods and Thunderstore links.
  • Use ModSettingsTags.Section and ModSettingsTags.Entry in ConfigDescription for display metadata, ordering, and custom slider steps. Lower order values appear first; unspecified values use 1000.

Complete example mods: Sunkenland example mods

Sorting example:

Config.Bind("General", "Enabled", true, new ConfigDescription(
    "Enable this mod.",
    null,
    ModSettingsTags.Section("General", order: 10),
    ModSettingsTags.Entry(order: 10)));

Config.Bind("General", "SpeedMultiplier", 1f, new ConfigDescription(
    "Adjust the speed multiplier.",
    new AcceptableValueRange<float>(0.5f, 3f),
    ModSettingsTags.Entry(order: 20, sliderStep: 0.25d)));

Put the section tag on any one entry in that section. Registered mods can alternatively use ConfigureSection and ConfigureEntry; registered values override tag values. Set ModSettingsEntryOptions.SliderStep to configure a registered range slider. Without a custom step, integer sliders use 1 and floating-point sliders use 0.1.

Optional hard dependency example:

using BepInEx;
using BepInEx.Configuration;
using ModSettingsMenu.Api;
using UnityEngine;

[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency(ModSettingsMenu.PluginInfo.PLUGIN_GUID)]
public sealed class MyPlugin : BaseUnityPlugin
{
    private void Awake()
    {
        Config.Bind("General", "Enabled", true, "Enable this mod.");
        Config.Bind("General", "SpeedMultiplier", 1f, new ConfigDescription("Adjust the speed multiplier.", new AcceptableValueRange<float>(0.1f, 5f)));
        Config.Bind("Controls", "QuickAction", KeyCode.F7, "Choose the quick action key.");

        ModSettingsRegistry.Register(
            PluginInfo.PLUGIN_GUID,
            new ModSettingsModOptions
            {
                Name = "My Mod",
                Description = "A short description shown above this mod's settings.",
                Author = "Author Name",
                Version = PluginInfo.PLUGIN_VERSION,
                NexusModsId = 6,
                ThunderstoreTeam = "MyTeam",
                ThunderstoreModName = "MyMod"
            });
    }
}

Localization API Example

For localized config entries and mod metadata, register the Sunkenland Localization API JSON file from the same directory as your plugin DLL. ModSettingsModOptions.Description is saved when the mod is registered, so register again after LocalizationApi.LanguageChanged to refresh the current-language description.

using System.IO;
using System.Reflection;
using BepInEx;
using BepInEx.Configuration;
using ModSettingsMenu.Api;
using SunkenlandLocalizationAPI.Api;
using UnityEngine;

[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency(ModSettingsMenu.PluginInfo.PLUGIN_GUID)]
[BepInDependency(SunkenlandLocalizationAPI.PluginInfo.PLUGIN_GUID)]
public sealed class MyPlugin : BaseUnityPlugin
{
    private ModLocalizer _localizer;

    private void Awake()
    {
        _localizer = LocalizationApi.For(PluginInfo.PLUGIN_GUID);
        string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
        _localizer.RegisterJson(Path.Combine(directory, "MyPlugin.Localization.json"));
        LocalizationApi.LanguageChanged += OnLanguageChanged;

        Config.Bind("General", "Enabled", true, _localizer.Config("config.enabled", 10, "General", "config.section.general", 10));
        Config.Bind("General", "SpeedMultiplier", 1f, _localizer.Config("config.speed_multiplier", 20, "General", "config.section.general", 10, new AcceptableValueRange<float>(0.5f, 3f), sliderStep: 0.25d));
        Config.Bind("Controls", "QuickAction", KeyCode.F7, _localizer.Config("config.quick_action", 10, "Controls", "config.section.controls", 20));

        RegisterSettings();
    }

    private void RegisterSettings()
    {
        ModSettingsRegistry.Register(
            PluginInfo.PLUGIN_GUID,
            new ModSettingsModOptions
            {
                Name = "My Mod",
                LocalizedName = () => _localizer.GetLocalizedText("mod.name"),
                Description = _localizer.GetLocalizedText("mod.description"),
                Author = "Author Name",
                Version = PluginInfo.PLUGIN_VERSION
            });
    }

    private void OnLanguageChanged(string language)
    {
        RegisterSettings();
    }
}

MyPlugin.Localization.json must contain an en section. Add any other supported game locale such as zh-Hans; missing keys fall back to en.

{
  "en": {
    "mod.name": "My Mod",
    "mod.description": "A short description of my mod.",
    "config.section.general": "General",
    "config.section.controls": "Controls",
    "config.enabled.name": "Enabled",
    "config.enabled.description": "Enable this mod.",
    "config.speed_multiplier.name": "Speed Multiplier",
    "config.speed_multiplier.description": "Adjust the speed multiplier.",
    "config.quick_action.name": "Quick Action",
    "config.quick_action.description": "Choose the quick action key."
  },
  "zh-Hans": {
    "mod.name": "我的模组",
    "mod.description": "我的模组简介。",
    "config.section.general": "通用",
    "config.section.controls": "控制",
    "config.enabled.name": "启用",
    "config.enabled.description": "启用这个模组。",
    "config.speed_multiplier.name": "速度倍率",
    "config.speed_multiplier.description": "调整速度倍率。",
    "config.quick_action.name": "快速操作",
    "config.quick_action.description": "选择快速操作按键。"
  }
}

ThunderstoreTeam and ThunderstoreModName must be provided together and may only contain ASCII letters, numbers, and underscores. The example opens https://thunderstore.io/c/sunkenland/p/MyTeam/MyMod/. Do not pass a full URL.

When both links are registered, the metadata uses the compact format V1.0.0 · Author Name · Nexus · Thunderstore to help keep it on one line. Nexus and Thunderstore remain separate clickable links with hover underlines.

The menu chooses controls from the config entry type and acceptable values:

  • bool: toggle
  • UnityEngine.KeyCode: key binding button
  • Numeric value with AcceptableValueRange: slider
  • Enum or AcceptableValueList: dropdown
  • Other supported serialized values: text field

Compatibility

  • Game version: Beta 0.8.41+

Installation

  1. Install BepInEx 5 for Sunkenland.
  2. Install Sunkenland Localization API.
  3. Extract this mod into the game's root folder. The archive already includes the BepInEx\plugins folder structure.

Bug Reports & Feature Suggestions

If you have any questions or feature suggestions, please submit them through GitHub Issues, contact me on Discord at iceboxcool, or email me at [email protected] or [email protected].


If you enjoy my mods, feel free to support me! / 如果你喜欢我的模组,请支持我一下吧!

Ko-fi   爱发电

Mod Settings Menu (中文)

在主菜单的设置下方和游戏内暂停菜单中添加模组设置按钮,为模组提供统一的配置界面。

主要功能

  • 左侧显示可配置的模组名称,右侧显示当前选中模组的设置项。
  • 模组作者可以选择注册显示名称、简介、作者、版本、Nexus Mods ID 和 Thunderstore 包信息。

给玩家

本模组不会自行修改游戏玩法,只为兼容的模组提供统一设置界面。 列表中只会显示已经加载并且至少包含一个配置项的模组。实际可用设置由你安装的其他模组决定。

模组作者 API

  • 注册不是必需的。已加载的 BepInEx 模组只要使用普通 Config.Bind 配置项,就会被自动识别。
  • 只有需要自定义元数据或提供 Nexus Mods、Thunderstore 链接时,才需要调用 ModSettingsRegistry.Register
  • ConfigDescription 中使用 ModSettingsTags.SectionModSettingsTags.Entry 设置显示元数据、排序和自定义滑条步进。排序数值越小越靠前,未指定时使用 1000

完整例子模组:Sunkenland 例子模组

排序示例:

Config.Bind("General", "Enabled", true, new ConfigDescription(
    "启用这个模组。",
    null,
    ModSettingsTags.Section("General", order: 10),
    ModSettingsTags.Entry(order: 10)));

Config.Bind("General", "SpeedMultiplier", 1f, new ConfigDescription(
    "调整速度倍率。",
    new AcceptableValueRange<float>(0.5f, 3f),
    ModSettingsTags.Entry(order: 20, sliderStep: 0.25d)));

每个分类只需在其中任意一个配置项上放置分类标签。已注册的模组也可以改用 ConfigureSectionConfigureEntry;注册值会覆盖标签值。通过 ModSettingsEntryOptions.SliderStep 可设置注册式范围滑条步进。未指定自定义步进时,整数滑条使用 1,浮点滑条使用 0.1

可选硬依赖示例:

using BepInEx;
using BepInEx.Configuration;
using ModSettingsMenu.Api;
using UnityEngine;

[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency(ModSettingsMenu.PluginInfo.PLUGIN_GUID)]
public sealed class MyPlugin : BaseUnityPlugin
{
    private void Awake()
    {
        Config.Bind("General", "Enabled", true, "启用这个模组。");
        Config.Bind("General", "SpeedMultiplier", 1f, new ConfigDescription("调整速度倍率。", new AcceptableValueRange<float>(0.1f, 5f)));
        Config.Bind("Controls", "QuickAction", KeyCode.F7, "选择快速操作按键。");

        ModSettingsRegistry.Register(
            PluginInfo.PLUGIN_GUID,
            new ModSettingsModOptions
            {
                Name = "我的模组",
                Description = "显示在这个模组设置项上方的简短介绍。",
                Author = "作者名称",
                Version = PluginInfo.PLUGIN_VERSION,
                NexusModsId = 6,
                ThunderstoreTeam = "MyTeam",
                ThunderstoreModName = "MyMod"
            });
    }
}

本地化 API 示例

需要本地化配置项和模组信息时,应从模组 DLL 所在目录加载 Sunkenland Localization API 的 JSON 文件。ModSettingsModOptions.Description 会在注册时保存,因此必须在 LocalizationApi.LanguageChanged 后重新注册,才能刷新为当前语言的简介。

using System.IO;
using System.Reflection;
using BepInEx;
using BepInEx.Configuration;
using ModSettingsMenu.Api;
using SunkenlandLocalizationAPI.Api;
using UnityEngine;

[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency(ModSettingsMenu.PluginInfo.PLUGIN_GUID)]
[BepInDependency(SunkenlandLocalizationAPI.PluginInfo.PLUGIN_GUID)]
public sealed class MyPlugin : BaseUnityPlugin
{
    private ModLocalizer _localizer;

    private void Awake()
    {
        _localizer = LocalizationApi.For(PluginInfo.PLUGIN_GUID);
        string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
        _localizer.RegisterJson(Path.Combine(directory, "MyPlugin.Localization.json"));
        LocalizationApi.LanguageChanged += OnLanguageChanged;

        Config.Bind("General", "Enabled", true, _localizer.Config("config.enabled", 10, "General", "config.section.general", 10));
        Config.Bind("General", "SpeedMultiplier", 1f, _localizer.Config("config.speed_multiplier", 20, "General", "config.section.general", 10, new AcceptableValueRange<float>(0.5f, 3f), sliderStep: 0.25d));
        Config.Bind("Controls", "QuickAction", KeyCode.F7, _localizer.Config("config.quick_action", 10, "Controls", "config.section.controls", 20));

        RegisterSettings();
    }

    private void RegisterSettings()
    {
        ModSettingsRegistry.Register(
            PluginInfo.PLUGIN_GUID,
            new ModSettingsModOptions
            {
                Name = "我的模组",
                LocalizedName = () => _localizer.GetLocalizedText("mod.name"),
                Description = _localizer.GetLocalizedText("mod.description"),
                Author = "作者名称",
                Version = PluginInfo.PLUGIN_VERSION
            });
    }

    private void OnLanguageChanged(string language)
    {
        RegisterSettings();
    }
}

MyPlugin.Localization.json 必须包含 en 节,也可以添加 zh-Hans 等游戏支持的语言;缺少当前语言的键时会回退到 en

{
  "en": {
    "mod.name": "My Mod",
    "mod.description": "A short description of my mod.",
    "config.section.general": "General",
    "config.section.controls": "Controls",
    "config.enabled.name": "Enabled",
    "config.enabled.description": "Enable this mod.",
    "config.speed_multiplier.name": "Speed Multiplier",
    "config.speed_multiplier.description": "Adjust the speed multiplier.",
    "config.quick_action.name": "Quick Action",
    "config.quick_action.description": "Choose the quick action key."
  },
  "zh-Hans": {
    "mod.name": "我的模组",
    "mod.description": "我的模组简介。",
    "config.section.general": "通用",
    "config.section.controls": "控制",
    "config.enabled.name": "启用",
    "config.enabled.description": "启用这个模组。",
    "config.speed_multiplier.name": "速度倍率",
    "config.speed_multiplier.description": "调整速度倍率。",
    "config.quick_action.name": "快速操作",
    "config.quick_action.description": "选择快速操作按键。"
  }
}

ThunderstoreTeamThunderstoreModName 必须成对填写,并且只能包含 ASCII 字母、数字和下划线。上面的例子会打开 https://thunderstore.io/c/sunkenland/p/MyTeam/MyMod/,不需要传入完整 URL。

同时注册两个链接时,元数据会使用 V1.0.0 · 作者名称 · Nexus · Thunderstore 的紧凑格式,尽量保持单行显示。Nexus 和 Thunderstore 仍是两个独立链接,并保留悬停下划线。

菜单根据配置项类型和可接受值选择控件:

  • bool:复选框
  • UnityEngine.KeyCode:按键绑定按钮
  • AcceptableValueRange 的数值:滑条
  • 枚举或 AcceptableValueList:下拉框
  • 其他支持序列化的值:文本输入框

兼容性

  • 游戏版本:Beta 0.8.41+

安装方法

  1. 为 Sunkenland 安装 BepInEx 5。
  2. 安装 Sunkenland Localization API。
  3. 将本模组解压到游戏根目录,压缩包内已包含 BepInEx\plugins 路径。

Bug 提交 & 新功能建议

如果你有任何问题或新功能建议,请通过 GitHub Issues 提交,也可以通过 Discord:iceboxcool,或邮箱 [email protected][email protected] 联系我。