SusBuffTray

紧凑的状态图标行 — 增益 / 减益图标,可选叠加层数徽标。
包
SusGame · HUD(商业)
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
MaxVisible | Prop<int> | 8 |
插槽
没有插槽。
事件
| 名称 | 字段 | 载荷 |
|---|---|---|
BuffClicked | OnBuffClicked | int |
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
sus-buff-traysus-buff-tray__buffsus-buff-tray__iconsus-buff-tray__stacks
用法
在代码中通过 SetBuffs / AddBuff 填充。XML 只限制可见数量上限。
csharp
var tray = new SusBuffTray();
tray.MaxVisible.Value = 8;
tray.OnBuffClicked += index => { /* open detail */ };
tray.SetBuffs(new List<(string icon, string stacks)>
{
("flame", "3"),
("shield", ""),
("poison", "2"),
});xml
<template>
<sus:SusBuffTray :MaxVisible="Max.Value"
@buff-clicked="OnBuffClicked" />
</template>
<script>
public Prop<int> Max = new(8);
void OnBuffClicked(int index) { /* … */ }
// Call SetBuffs / AddBuff / ClearBuffs from status code.
</script>| Prop / API | 作用 |
|---|---|
MaxVisible | 图标数量上限(默认 8) |
SetBuffs(list) | 用 (icon, stacks) 替换所有图标 |
AddBuff(icon, stacks) | 追加,直至达到上限 |
ClearBuffs() | 移除全部 |
OnBuffClicked | 被点击的 buff 索引 |
备注
- 在调用
SetBuffs/AddBuff之前为空 —— 这是刻意设计,方便用演示数据做展示截图。 - 层数文字是可选的;为空时隐藏徽标。
- 需要更丰富的单效果图标时,搭配 SusStatusEffect 使用。