跳转到内容

SusHealthBar

SusHealthBar

带动画的 HP 填充条(0…1),可选百分比标签,支持 healthy / warning / critical 阈值状态。

SusKit · 世界(商业)

在 Playground 中打开

SusKit · World

属性

名称类型默认值
ValueProp<float>1f
ShowLabelProp<bool>true

插槽

没有插槽。

事件

没有公开事件。

样式钩子

USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:

  • hb-fill
  • hb-label
  • sus-healthbar
  • sus-healthbar--critical
  • sus-healthbar--healthy
  • sus-healthbar--warning

用法

csharp
var hp = new SusHealthBar();
hp.Value.Value = 0.72f;
hp.ShowLabel.Value = true;
xml
<template>
  <sus:SusHealthBar :Value="Hp.Value"
                    :ShowLabel="ShowLabel.Value" />
</template>

<script>
public Prop<float> Hp = new(0.72f);
public Prop<bool> ShowLabel = new(true);
</script>
Prop作用
Value比例值 0…1(视觉上会被钳制)
ShowLabel在血条上显示百分比文本

备注

  • 阈值样式类:healthy / warning / critical(由 Value 驱动)。
  • 填充会向新值做动画过渡(约 0.4 秒);请从战斗 tick 更新 Value