SusAbilityBar

Horizontal ability strip — rebuilds SusAbilitySlot children, fills from SusHudAbilityData, digits 1…N activate when not in hold mode.
Package
SusGame · HUD (commercial)
SusGame · HUD
Props
| Name | Type | Default | |
|---|---|---|---|
SlotCount | Prop<int> | 4 | |
UseHold | Prop<bool> | false | |
KeyScope | Prop<string> | "focus" |
Slots
No slots.
Events
| Name | Field | Payload |
|---|---|---|
AbilityActivated | OnAbilityActivated | int |
AbilityHoldComplete | OnAbilityHoldComplete | int |
Style hooks
USS class contract — override appearance without touching C#. States toggle via these classes:
sus-ability-barsus-hidden
Usage
Drive slot contents from code with SetAbilities. XML only sets layout/mode props.
csharp
var bar = new SusAbilityBar();
bar.SlotCount.Value = 4;
bar.UseHold.Value = false;
bar.OnAbilityActivated += index => { /* cast / spend AP */ };
bar.OnAbilityHoldComplete += index => { /* charged cast */ };
bar.SetAbilities(new List<SusHudAbilityData>
{
new() { Id = "strike", Icon = "sword", Title = "Strike", Keybind = "1" },
new() { Id = "heal", Icon = "plus", Title = "Heal", Cooldown01 = 0.4f, CooldownText = "2s" },
new() { Id = "shield", Icon = "shield", Title = "Guard", Disabled = true },
});xml
<template>
<sus:SusAbilityBar :SlotCount="Slots.Value"
:UseHold="Hold.Value"
@ability-activated="OnAbilityActivated"
@ability-hold-complete="OnAbilityHoldComplete" />
</template>
<script>
public Prop<int> Slots = new(4);
public Prop<bool> Hold = new(false);
void OnAbilityActivated(int index) { /* … */ }
void OnAbilityHoldComplete(int index) { /* … */ }
// Call SetAbilities / UpdateAbility from combat code after mount.
</script>| Prop / API | Role |
|---|---|
SlotCount | Slot count (1…10, default 4) |
UseHold | Propagates hold mode to every slot |
SetAbilities(list) | Resize + fill from SusHudAbilityData |
UpdateAbility(i, data) | Patch one slot |
GetSlot(i) | Access child SusAbilitySlot |
OnAbilityActivated | Index of activated slot |
OnAbilityHoldComplete | Index after hold completes |
ActivateSlot(i) | Activate slot i from your own input — same as a click |
KeyScope | Where the bar listens for keys: "focus" (default) or "panel" |
Ability keys
By default ability input stays on the game side: your game reads its own input and calls ActivateSlot(index). That call works exactly like a click — it raises OnAbilityActivated unless the slot is a hold slot, disabled or on cooldown.
csharp
// in your input handler
if (Input.GetKeyDown(KeyCode.Q)) bar.ActivateSlot(0);KeyScope chooses where the bar itself listens for keys:
"focus"(default): digits 1–9 (top row or keypad) activate slot N-1, but only while the bar has focus. In battle the focus is usually elsewhere, so these keys do nothing there."panel": the bar listens on the whole panel while it is attached, no focus needed. The pressed key is matched against each slot'sKeybindstring — a digit, a letter or aKeyCodename such asF1. Keys typed into a text field are ignored, hold slots are not activated by a key, and only a key bound to a slot stops propagation.
Notes
- Empty until
SetAbilities(or host/Assembler fills slots). Calling before mount queues untilMounted. SusHudAbilityData:Id,Icon,Title,Description,Cooldown01(0ready …1full),CooldownText,Disabled, optionalKeybind(empty → index+1).- Prefer the bar over hand-wiring many SusAbilitySlot instances when you need a shared key contract.