🛠️ optimization: 将配置界面的选项拆分成不同的类别

This commit is contained in:
TheWhiteDog9487
2026-09-16 16:19:27 +08:00
parent 2882def6bc
commit dc2b661d51
3 changed files with 44 additions and 32 deletions
@@ -18,37 +18,45 @@ class ModMenuEntryPoint: ModMenuApi {
.name(Component.translatable("config.category.general")) .name(Component.translatable("config.category.general"))
.option { .option {
Option.createBuilder<Boolean>() Option.createBuilder<Boolean>()
.name(Component.translatable("option.ModEnabled")) .name(Component.translatable("option.general.ModEnabled"))
.description { OptionDescription.of(Component.translatable("option.ModEnabled.description") ) } .description { OptionDescription.of(Component.translatable("option.general.ModEnabled.description") ) }
.binding( true, { SettingsInstance.ModEnabled }, { SettingsInstance.ModEnabled = it } ) .binding( true, { SettingsInstance.ModEnabled }, { SettingsInstance.ModEnabled = it } )
.controller(BooleanControllerBuilder::create ) .controller(BooleanControllerBuilder::create )
.build() } .build() }
.build() }
.category {
ConfigCategory.createBuilder()
.name(Component.translatable("config.category.feature"))
.option { .option {
Option.createBuilder<Boolean>() Option.createBuilder<Boolean>()
.name(Component.translatable("option.ShowModID")) .name(Component.translatable("option.feature.ShowModID"))
.description { OptionDescription.of(Component.translatable("option.ShowModID.description") ) } .description { OptionDescription.of(Component.translatable("option.feature.ShowModID.description") ) }
.binding( false, { SettingsInstance.ShowModID }, { SettingsInstance.ShowModID = it } ) .binding( false, { SettingsInstance.ShowModID }, { SettingsInstance.ShowModID = it } )
.controller(BooleanControllerBuilder::create ) .controller(BooleanControllerBuilder::create )
.build() } .build() }
.option { .option {
Option.createBuilder<Boolean>() Option.createBuilder<Boolean>()
.name(Component.translatable("option.ShowKeybindID")) .name(Component.translatable("option.feature.ShowKeybindID"))
.description { OptionDescription.of(Component.translatable("option.ShowKeybindID.description") ) } .description { OptionDescription.of(Component.translatable("option.feature.ShowKeybindID.description") ) }
.binding( false, { SettingsInstance.ShowKeybindID }, { SettingsInstance.ShowKeybindID = it } ) .binding( false, { SettingsInstance.ShowKeybindID }, { SettingsInstance.ShowKeybindID = it } )
.controller(BooleanControllerBuilder::create ) .controller(BooleanControllerBuilder::create )
.build() } .build() }
.option { .option {
Option.createBuilder<Boolean>() Option.createBuilder<Boolean>()
.name(Component.translatable("option.ShowDebugInfo")) .name(Component.translatable("option.feature.ShowFilePath"))
.description { OptionDescription.of(Component.translatable("option.ShowDebugInfo.description") ) } .description { OptionDescription.of(Component.translatable("option.feature.ShowFilePath.description") ) }
.binding( false, { SettingsInstance.ShowDebugInfo }, { SettingsInstance.ShowDebugInfo = it } ) .binding( false, { SettingsInstance.ShowFilePath }, { SettingsInstance.ShowFilePath = it } )
.controller(BooleanControllerBuilder::create ) .controller(BooleanControllerBuilder::create )
.build() } .build() }
.build() }
.category {
ConfigCategory.createBuilder()
.name(Component.translatable("config.category.debug"))
.option { .option {
Option.createBuilder<Boolean>() Option.createBuilder<Boolean>()
.name(Component.translatable("option.ShowFilePath")) .name(Component.translatable("option.debug.ShowDebugInfo"))
.description { OptionDescription.of(Component.translatable("option.ShowFilePath.description") ) } .description { OptionDescription.of(Component.translatable("option.debug.ShowDebugInfo.description") ) }
.binding( false, { SettingsInstance.ShowFilePath }, { SettingsInstance.ShowFilePath = it } ) .binding( false, { SettingsInstance.ShowDebugInfo }, { SettingsInstance.ShowDebugInfo = it } )
.controller(BooleanControllerBuilder::create ) .controller(BooleanControllerBuilder::create )
.build() } .build() }
.build() } .build() }
@@ -5,16 +5,18 @@
"link.blog": "TheWhiteDog9487's Blog", "link.blog": "TheWhiteDog9487's Blog",
"title.config": "Who Provides This Keybind?", "title.config": "Who Provides This Keybind?",
"config.category.general": "General", "config.category.general": "General",
"option.ModEnabled": "Enable Mod Functionality", "config.category.feature": "Feature",
"option.ModEnabled.description": "Changes take effect immediately after modification and save without restarting the game", "config.category.debug": "Debug",
"option.ShowModID": "Show Mod ID", "option.general.ModEnabled": "Enable Mod Functionality",
"option.ShowModID.description": "Display the Mod ID of the provider in the tooltip", "option.general.ModEnabled.description": "Changes take effect immediately after modification and save without restarting the game",
"option.ShowKeybindID": "Show Keybind ID", "option.feature.ShowModID": "Show Mod ID",
"option.ShowKeybindID.description": "Display the keybind's own ID in the tooltip", "option.feature.ShowModID.description": "Display the Mod ID of the provider in the tooltip",
"option.ShowDebugInfo": "Show Debug Info", "option.feature.ShowKeybindID": "Show Keybind ID",
"option.ShowDebugInfo.description": "This information is used to troubleshoot issues related to this mod; it generally does not need to be enabled", "option.feature.ShowKeybindID.description": "Display the keybind's own ID in the tooltip",
"option.ShowFilePath": "Show File Path", "option.feature.ShowFilePath": "Show File Path",
"option.ShowFilePath.description": "Display the mod file path in the information", "option.feature.ShowFilePath.description": "Display the mod file path in the information",
"option.debug.ShowDebugInfo": "Show Debug Info",
"option.debug.ShowDebugInfo.description": "This information is used to troubleshoot issues related to this mod; it generally does not need to be enabled",
"tooltip.provided_by": "Provided by: %s", "tooltip.provided_by": "Provided by: %s",
"tooltip.provider_mod_id": "Provider Mod ID: %s", "tooltip.provider_mod_id": "Provider Mod ID: %s",
"tooltip.key_id": "Keybind ID: %s", "tooltip.key_id": "Keybind ID: %s",
@@ -5,16 +5,18 @@
"link.blog": "TheWhiteDog9487的博客", "link.blog": "TheWhiteDog9487的博客",
"title.config": "谁在提供这个键位?", "title.config": "谁在提供这个键位?",
"config.category.general": "通用", "config.category.general": "通用",
"option.ModEnabled": "是否启用模组功能", "config.category.feature": "功能",
"option.ModEnabled.description": "无需重启游戏,修改并保存后立刻生效", "config.category.debug": "调试",
"option.ShowModID": "是否显示Mod ID", "option.general.ModEnabled": "是否启用模组功能",
"option.ShowModID.description": "在提示信息中显示提供该按键的Mod的ID", "option.general.ModEnabled.description": "无需重启游戏,修改并保存后立刻生效",
"option.ShowKeybindID": "是否显示键位ID", "option.feature.ShowModID": "是否显示Mod ID",
"option.ShowKeybindID.description": "在提示信息中显示该按键本身的ID", "option.feature.ShowModID.description": "在提示信息中显示提供该按键的Mod的ID",
"option.ShowDebugInfo": "是否显示调试信息", "option.feature.ShowKeybindID": "是否显示键位ID",
"option.ShowDebugInfo.description": "这些信息用于出现和本Mod相关的问题时进行排查,一般情况下不需要开启", "option.feature.ShowKeybindID.description": "在提示信息中显示该按键本身的ID",
"option.ShowFilePath": "是否显示文件路径", "option.feature.ShowFilePath": "是否显示文件路径",
"option.ShowFilePath.description": "在信息中显示Mod的文件路径", "option.feature.ShowFilePath.description": "在信息中显示Mod的文件路径",
"option.debug.ShowDebugInfo": "是否显示调试信息",
"option.debug.ShowDebugInfo.description": "这些信息用于出现和本Mod相关的问题时进行排查,一般情况下不需要开启",
"tooltip.provided_by": "提供者:%s", "tooltip.provided_by": "提供者:%s",
"tooltip.provider_mod_id": "提供者ID%s", "tooltip.provider_mod_id": "提供者ID%s",
"tooltip.key_id": "键位ID%s", "tooltip.key_id": "键位ID%s",