Skip to main content

getItem 获取快捷栏的物品

getItem

类型: MethodDeclaration

所属类: ShortcutManager

定义位置: actor.ts

描述

获取快捷栏的物品

参数 key: 快捷键

返回值:物品实例

参数

参数名类型描述默认值
keystring--

返回值

类型: Item | undefined

物品实例

源代码

位置: 第 4974 行

public getItem(key: string): Item | undefined {
const shortcut = this.keyMap[key];
if (shortcut?.type === "item") {
return this.actor.inventory.get(shortcut.id) as Item;
}
return undefined;
}

文档生成时间:2026/2/1 16:51:38