SusHotbar

物品栏快捷条 — N 个带按键标签的槽位,选中态外观,支持数字键 1…N / 方向键 / Enter。
包
SusGame · HUD(商业)
SusGame · HUD
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
SlotCount | Prop<int> | 6 | |
SelectedIndex | Prop<int> | 0 | |
CooldownStyle | Prop<string> | "Radial" |
插槽
没有插槽。
事件
| 名称 | 字段 | 载荷 |
|---|---|---|
SlotActivated | OnSlotActivated | int |
SelectionChanged | OnSelectionChanged | int |
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
sus-hotbarsus-hotbar__cd-wipesus-hotbar__iconsus-hotbar__icon-hostsus-hotbar__keysus-hotbar__slotsus-hotbar__slot--selectedsus-hotbar__title
用法
csharp
var bar = new SusHotbar();
bar.SlotCount.Value = 6;
bar.SelectedIndex.Value = 0;
bar.OnSlotActivated += i => { /* use item */ };
bar.OnSelectionChanged += i => { /* highlight */ };
bar.SetSlotIcon(0, "potion");
bar.SetSlotLabel(0, "Heal");
bar.SetSlotIcon(1, "bomb");
bar.SetSlotLabel(1, "Grenade");xml
<template>
<sus:SusHotbar :SlotCount="Slots.Value"
:SelectedIndex="Selected.Value"
@slot-activated="OnSlotActivated"
@selection-changed="OnSelectionChanged" />
</template>
<script>
public Prop<int> Slots = new(6);
public Prop<int> Selected = new(0);
void OnSlotActivated(int index) { /* … */ }
void OnSelectionChanged(int index) { /* … */ }
// Call SetSlotIcon / SetSlotLabel after mount (slots rebuild on SlotCount).
</script>| Prop / API | 作用 |
|---|---|
SlotCount | 槽位数 1…10(默认 6) |
SelectedIndex | 选中的槽位(视觉 + 键盘) |
SetSlotIcon(i, name) | 设置槽位图标 |
SetSlotLabel(i, text) | 图标下方的标题 |
OnSlotActivated | 点击 / 数字键 / Enter |
OnSelectionChanged | 选中项变化 |
备注
SlotCount变化时槽位会重建 —— 请在重建 / 挂载之后设置图标 / 标签。- 键盘操作:数字键
1…N、Home/End、方向键(漫游焦点)、空格 / Enter 激活。 - 战斗技能优先使用 SusAbilityBar;hotbar 是物品栏快捷键的约定。