Ice_Box_Studio_GK2-ModSettingsMenu icon

ModSettingsMenu

Adds a Mod Settings button under Settings in the main menu and pause menu, with a unified config UI that auto-shows mod config entries (no registration) and supports localization via the GK2 Localization API and user-editable JSON.

Last updated 5 hours ago
Total downloads 13
Total rating 0 
Categories Mods
Dependency string Ice_Box_Studio_GK2-ModSettingsMenu-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2305
Ice_Box_Studio_GK2-GK2LocalizationAPI-1.0.0 icon
Ice_Box_Studio_GK2-GK2LocalizationAPI

Graveyard Keeper 2 Localization API is a shared localization library for Graveyard Keeper 2 mods, making it easier for mod authors to add multilingual support to their mods.

Preferred version: 1.0.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 that automatically displays mod configuration entries without registration and supports text localization through the Graveyard Keeper 2 Localization API and user-editable JSON files.

Main Features

  • Shows configurable mod names on the left and the selected mod's settings on the right.
  • Automatically displays configuration entries from loaded BepInEx mods without requiring registration with Mod Settings Menu.
  • Lets mod authors optionally register a display name, description, author, version, Nexus Mods ID, and Thunderstore package.
  • Supports optional update checks, with update status shown to the right of the mod metadata.
  • Supports text localization through the Graveyard Keeper 2 Localization API. Users can edit the JSON files generated in BepInEx/config/ModSettingsMenu.Localization to translate mod names, categories, setting names, descriptions, and supported option text, even when a mod does not provide its own translations. Text follows the current game language; switching languages adds missing entries while preserving existing translations.

For Players

This mod does not change gameplay by itself. It provides a common settings screen for compatible mods. Loaded mods with at least one configuration entry appear in the list. Mod Settings Menu itself also appears to show its metadata and update status. 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.

Example mods for reference: Graveyard Keeper 2 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 Graveyard Keeper 2 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 GraveyardKeeper2LocalizationAPI.Api;
using UnityEngine;

[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency(ModSettingsMenu.PluginInfo.PLUGIN_GUID)]
[BepInDependency(GraveyardKeeper2LocalizationAPI.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_cn; 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_cn": {
    "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/graveyard-keeper-2/p/MyTeam/MyMod/. Do not pass a full URL.

Compatibility

  • Game: Graveyard Keeper 2
  • Loader: BepInEx 5.4.23.5 (Unity Mono)

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 (中文)

在主菜单的设置下方和游戏内暂停菜单中添加模组设置按钮,为模组提供统一的配置界面,无需注册即可自动显示模组配置项,并通过守墓人 2 本地化 API 和用户可编辑的 JSON 文件支持模组名称及配置文本本地化。

主要功能

  • 左侧显示可配置的模组名称,右侧显示当前选中模组的设置项。
  • 自动显示已加载 BepInEx 模组的配置项,无需向模组设置菜单注册。
  • 模组作者可以选择注册显示名称、简介、作者、版本、Nexus Mods ID 和 Thunderstore 包信息。
  • 支持可选的更新检查,更新状态显示在模组元数据右侧。
  • 通过守墓人 2 本地化 API 支持文本本地化。用户可编辑 BepInEx/config/ModSettingsMenu.Localization 中生成的 JSON 文件,翻译模组名称、分类、配置项名称、说明及支持的选项文本,即使模组自身没有提供翻译也可使用。文本跟随游戏当前语言,切换语言时补入缺失项,保留已有译文。

给玩家

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

模组作者 API

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

参考例子模组:Graveyard Keeper 2 例子模组

排序示例:

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)));

每个分类只需在其中任意一个配置项上放置分类标签。已注册的模组也可以改用 ConfigureSection 和 ConfigureEntry;注册值会覆盖标签值。通过 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 所在目录加载守墓人 2 Localization API 的 JSON 文件。ModSettingsModOptions.Description 会在注册时保存,因此必须在 LocalizationApi.LanguageChanged 后重新注册,才能刷新为当前语言的简介。

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

[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency(ModSettingsMenu.PluginInfo.PLUGIN_GUID)]
[BepInDependency(GraveyardKeeper2LocalizationAPI.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_cn 等游戏支持的语言;缺少当前语言的键时会回退到 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_cn": {
    "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 和 ThunderstoreModName 必须成对填写,并且只能包含 ASCII 字母、数字和下划线。上面的例子会打开 https://thunderstore.io/c/graveyard-keeper-2/p/MyTeam/MyMod/,不需要传入完整 URL。

兼容性

  • 游戏:守墓人 2
  • 加载器:BepInEx 5.4.23.5(Unity Mono)

Bug 提交 & 新功能建议

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