id: 快捷栏HUD
version: 1
title: 快捷栏 HUD 示例
size:
  width: window.width
  height: window.height
coordinateMode: absolute
display:
  mode: hud
  hud:
    always: true
    replaces:
    - hotbar
elements:
- id: hotbar_background
  type: rect
  visible: true
  enabled: false
  pointerEvents: pass
  opacity: 0.82
  z: 0
  layout:
    x: 'window.width * 0.5 - 92'
    y: 'window.height - 25'
    width: '184'
    height: '22'
  rect:
    color: '#111111'
- id: selected_slot
  type: rect
  visible: true
  enabled: false
  pointerEvents: pass
  opacity: 0.38
  z: 1
  layout:
    x: 'window.width * 0.5 - 90 + vals.player.inventory.heldItemSlot * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  rect:
    color: '#FFFFFF'
- id: hotbar_0
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 0 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_0
    mode: mapped
    allowPut: true
    allowTake: true
- id: hotbar_1
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 1 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_1
    mode: mapped
    allowPut: true
    allowTake: true
- id: hotbar_2
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 2 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_2
    mode: mapped
    allowPut: true
    allowTake: true
- id: hotbar_3
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 3 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_3
    mode: mapped
    allowPut: true
    allowTake: true
- id: hotbar_4
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 4 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_4
    mode: mapped
    allowPut: true
    allowTake: true
- id: hotbar_5
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 5 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_5
    mode: mapped
    allowPut: true
    allowTake: true
- id: hotbar_6
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 6 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_6
    mode: mapped
    allowPut: true
    allowTake: true
- id: hotbar_7
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 7 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_7
    mode: mapped
    allowPut: true
    allowTake: true
- id: hotbar_8
  type: item_slot
  visible: true
  enabled: true
  pointerEvents: auto
  opacity: 1
  z: 2
  layout:
    x: 'window.width * 0.5 - 90 + 8 * 20'
    y: 'window.height - 23'
    width: '18'
    height: '18'
  itemSlot:
    bind: backpack_8
    mode: mapped
    allowPut: true
    allowTake: true
- id: mainhand_info
  type: text
  visible: true
  enabled: false
  pointerEvents: pass
  opacity: 1
  z: 3
  layout:
    x: 'window.width * 0.5 - 120'
    y: 'window.height - 38'
    width: '240'
    height: '10'
  text:
    value: "主手：{vals.player.inventory.mainhand.id} × {vals.player.inventory.mainhand.count}"
    color: '#FFFFFF'
    textSize: 0.75
    textLineLength: 256
    revealIntervalMs: 0
    align: center
