Skip to content

SusHudWeaponPanel

SusHudWeaponPanel

Weapon option row — kit buttons with icon / label; click selects a weapon id.

Package

SusGame · HUD (commercial)

Open in Playground

SusGame · HUD

Props

No public props.

Slots

No slots.

Events

NameFieldPayload
WeaponSelectedOnWeaponSelectedstring

Style hooks

USS class contract — override appearance without touching C#. States toggle via these classes:

  • sus-hud-weapon-panel
  • sus-hud-weapon-panel__btn
  • sus-hud-weapon-panel__row
  • sus-hud-weapon-panel__title

Usage

List-driven: SetWeapons. XML is chrome only (fixed “WEAPON” title).

csharp
var panel = new SusHudWeaponPanel();
panel.OnWeaponSelected += id => { /* equip / mode */ };

panel.SetWeapons(new List<SusHudWeaponOption>
{
    new() { Id = "rifle", Label = "Rifle", Icon = "crosshair", Description = "Mid range", Selected = true },
    new() { Id = "shotgun", Label = "Shotgun", Icon = "target", Description = "Close" },
});

panel.SetSelected("shotgun");
xml
<template>
  <sus:SusHudWeaponPanel @weapon-selected="OnWeaponSelected" />
</template>

<script>
void OnWeaponSelected(string id) { /* … */ }
// Call SetWeapons / SetSelected from loadout / combat code after mount.
</script>
Prop / APIRole
SetWeapons(list)Build / in-place update from SusHudWeaponOption
SetSelected(id)Active + tonal vs outlined
ClearWeapons()Remove all buttons
OnWeaponSelectedSelected weapon Id (string)

Notes

  • Empty until SetWeapons (pre-mount calls queue).
  • SusHudWeaponOption: Id, Label, Icon (PrependIcon), Description (tooltip), Selected.
  • Same id set → state update without remount (avoids button size thrash).