MTDUI
A simple UI library for 20 Minutes Till Dawn.
模組介紹 作者原文
MTDUI
A simple UI library for 20 Minutes Till Dawn.
For Developers
MTDUI is primarily meant to be used in conjunction with the BepInEx configuration system.
NOTE: MTDUI is still in early development, and as such only currently supports a few types of config options:
| ConfigEntry Type | Supported |
| ------------- | ------------- |
| Enum | ✅ |
| Int | ✅ |
| Float | ✅ |
| Bool | ✅ |
| String | ❌ |
| Others? | ❌ |
Support for new ConfigEntry types will be added as the library matures.
Example Usage
using MTDUI;
// Create a new configuration file using the BepInEx config system
var customFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "GameSpeed.cfg"), true);
// Add a config option
var gameSpeed = customFile.Bind("General", "Game Speed", 1, "The speed at which the game runs.");
// Register the config option with MTDUI's in-game mod settings
// 1, 2, 3, 4, 5, and 10 are valid options that can be selected
// NOTE: Enums and Bools will have this list automatically filled, but you need to manually add values for ints/floats
// This is visible on the title screen and pause menu by default
ModOptions.Register(gameSpeed, new List(){ 1, 2, 3, 4, 5, 10 });
// gameSpeed should now be updated when changed in the ingame UI (or when the cfg file is manually modified)
// Use gameSpeed.Value when you want to actually use the value
// Other options:
// You can control which menu a setting will appear on by using ConfigEntryLocationType
// This can be useful if you have settings you don't want people to change mid-run
ModOptions.Register(gameSpeed, new List(){ 1, 2, 3, 4, 5, 10 }, ConfigEntryLocationType.PauseOnly); // only appears in the in-game pause menu
ModOptions.Register(gameSpeed, new List(){ 1, 2, 3, 4, 5, 10 }, ConfigEntryLocationType.MainOnly); // only appears on the title screen
// You can make the option appear on a custom sub-menu by passing a string
ModOptions.Register(gameSpeed, new List(){ 1, 2, 3, 4, 5, 10 }, ConfigEntryLocationType.Everywhere, "Custom SubMenu"); // appears in a "Custom SubMenu" tab
// You can use RegisterOptionInModList to add configs to a "Mod List" subpanel
// This section is mostly intended to be used for activation/deactivation, as to not clutter up the submenu with inactive mods
// The expected usage is to disable the rest of the plugin if enabled
activateMod = Config.Bind("General", "Activation", true, "If false, the mod does not load");
ModOptions.RegisterOptionInModList(activateMod);
if (!activateMod.Value) return;
For more information on how the BepInEx config system works, check out the official documentation.
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: