getTarget 获取快捷栏的目标对象(物品或技能)
getTarget
类型: MethodDeclaration
所属类: ShortcutManager
定义位置: actor.ts
描述
获取快捷栏的目标对象(物品或技能)
参数 key: 快捷键
返回值:物品或技能实例
参数
| 参数名 | 类型 | 描述 | 默认值 | 
|---|---|---|---|
| key | string | - | - | 
返回值
类型: Skill \| Item \| undefined
物品或技能实例
源代码
位置: 第 4732 行
public getTarget(key: string): Skill | Item | undefined {
    const shortcut = this.keyMap[key]
    switch (shortcut?.type) {
      case 'skill':
        return this.actor.skill.get(shortcut.id)
      case 'item':
        return this.actor.inventory.get(shortcut.id) as Item
      default:
        return undefined
    }
  }
文档生成时间:2025/7/21 20:53:38