mirror of
https://github.com/TheWhiteDog9487/WhoProvideThisKeybind.git
synced 2026-09-16 15:04:19 +08:00
🧩 feat: 支持显示Mod文件路径
This commit is contained in:
@@ -34,7 +34,8 @@ data class ModInfo(val ModContainerInstance: ModContainer?) {
|
||||
val ID: String = ModContainerInstance?.metadata?.id ?: Component.translatable("special_provider_UNKNOWN").string
|
||||
val MetaData: ModMetadata? = ModContainerInstance?.metadata
|
||||
val DisplayName: String = MetaData?.name ?: Component.translatable("special_provider_UNKNOWN").string
|
||||
val HumanFriendlyName: Component = Component.translatableWithFallback("modmenu.nameTranslation." + (MetaData?.id ?: "unknown"), DisplayName) }
|
||||
val HumanFriendlyName: Component = Component.translatableWithFallback("modmenu.nameTranslation." + (MetaData?.id ?: "unknown"), DisplayName)
|
||||
val FilePath: String = ModContainerInstance?.origin?.paths?.joinToString("\n") { it.pathString } ?: Component.translatable("special_string_UNKNOWN").string }
|
||||
|
||||
fun Button.SetNewTooltip(Key: KeyMapping) {
|
||||
if (SettingsInstance.ModEnabled == false) return
|
||||
@@ -62,4 +63,9 @@ fun Button.SetNewTooltip(Key: KeyMapping) {
|
||||
.append(Component.translatable("tooltip.key_id",
|
||||
Component.literal(Key.name))) }
|
||||
|
||||
// 第四行:文件路径
|
||||
if (SettingsInstance.ShowFilePath) {
|
||||
NewTooltip.append(Component.literal("\n"))
|
||||
.append(Component.translatable("tooltip.mod_file_path", Mod.FilePath)) }
|
||||
|
||||
setTooltip(Tooltip.create(NewTooltip)) }
|
||||
@@ -51,6 +51,13 @@ class ModMenuEntryPoint: ModMenuApi {
|
||||
.binding( false, { SettingsInstance.SearchInStackTrace }, { SettingsInstance.SearchInStackTrace = it } )
|
||||
.controller(BooleanControllerBuilder::create )
|
||||
.build() }
|
||||
.option {
|
||||
Option.createBuilder<Boolean>()
|
||||
.name(Component.translatable("option.ShowFilePath"))
|
||||
.description { OptionDescription.of(Component.translatable("option.ShowFilePath.description") ) }
|
||||
.binding( false, { SettingsInstance.ShowFilePath }, { SettingsInstance.ShowFilePath = it } )
|
||||
.controller(BooleanControllerBuilder::create )
|
||||
.build() }
|
||||
.build() }
|
||||
.build()
|
||||
.generateScreen(ParentScreen) } }
|
||||
@@ -13,6 +13,8 @@
|
||||
"option.ShowKeybindID.description": "Display the keybind's own ID in the tooltip",
|
||||
"option.ShowDebugInfo": "Show Debug Info",
|
||||
"option.ShowDebugInfo.description": "This information is used to troubleshoot issues related to this mod; it generally does not need to be enabled",
|
||||
"option.ShowFilePath": "Show File Path",
|
||||
"option.ShowFilePath.description": "Display the mod file path in the information",
|
||||
"option.SearchInStackTrace": "Enable aggressive search via stack trace lookup",
|
||||
"option.SearchInStackTrace.description": "Injects into the KeyMapping class constructor and queries the current thread's call stack each time a keybind is registered for aggressive matching\nWarning: In some cases, this may produce more false positives; enable as needed",
|
||||
"tooltip.provided_by": "Provided by: %s",
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
"option.ShowKeybindID.description": "在提示信息中显示该按键本身的ID",
|
||||
"option.ShowDebugInfo": "是否显示调试信息",
|
||||
"option.ShowDebugInfo.description": "这些信息用于出现和本Mod相关的问题时进行排查,一般情况下不需要开启",
|
||||
"option.ShowFilePath": "是否显示文件路径",
|
||||
"option.ShowFilePath.description": "在信息中显示Mod的文件路径",
|
||||
"option.SearchInStackTrace": "是否要通过查询堆栈信息来进行强力搜索",
|
||||
"option.SearchInStackTrace.description": "注入KeyMapping类的构造函数,在每次注册按键绑定时查询线程的调用栈信息来进行强力匹配\n警告:部分情况下可能产生更多误报,请按需选择",
|
||||
"tooltip.provided_by": "提供者:%s",
|
||||
|
||||
Reference in New Issue
Block a user