Skip to content

SusHudTargetPanel

SusHudTargetPanel

Target chip row — icon + hit % (+ optional label); click / Enter selects a target id.

Package

SusGame · HUD (commercial)

Open in Playground

SusGame · HUD

Props

No public props.

Slots

No slots.

Events

NameFieldPayload
TargetSelectedOnTargetSelectedstring

Style hooks

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

  • sus-hud-target-panel
  • sus-hud-target-panel__icon
  • sus-hud-target-panel__item
  • sus-hud-target-panel__item--selected
  • sus-hud-target-panel__label
  • sus-hud-target-panel__pct
  • sus-hud-target-panel__row
  • sus-hud-target-panel__title

Usage

List-driven: fill from code with SetTargets. XML is chrome only (fixed “TARGETS” title).

csharp
var panel = new SusHudTargetPanel();
panel.OnTargetSelected += id => { /* lock target */ };

panel.SetTargets(new List<SusHudTargetData>
{
    new() { Id = "e1", Icon = "crosshair", Label = "Raider", HitChance01 = 0.72f, Selected = true },
    new() { Id = "e2", Icon = "crosshair", Label = "Scout", HitChance01 = 0.45f },
});

panel.UpdateHitChance("e1", 0.80f);
panel.SetSelected("e2");
xml
<template>
  <sus:SusHudTargetPanel @target-selected="OnTargetSelected" />
</template>

<script>
void OnTargetSelected(string id) { /* … */ }
// Call SetTargets / UpdateHitChance / SetSelected from combat code after mount.
</script>
Prop / APIRole
SetTargets(list)Rebuild chips from SusHudTargetData
UpdateHitChance(id, hitChance01)Patch % without full rebuild
SetSelected(id)Toggle --selected class
ClearTargets()Remove all chips
OnTargetSelectedSelected target Id (string)

Notes

  • Empty until SetTargets (calls before mount queue until Mounted).
  • SusHudTargetData: Id (required), Icon (default crosshair), Label, HitChance01 (0…1N%), Selected.
  • Keyboard: focused chip activates on Enter / Space.