SusHudPlayerStatus

玩家身份区块 — 头像、名称,以及 HP / MP / XP 进度条行。
包
SusGame · HUD(商业)
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
PlayerName | Prop<string> | "Player" | |
AvatarImage | Prop<string> | "" | |
AvatarText | Prop<string> | "P" | |
Hp | Prop<float> | 100f | |
HpMax | Prop<float> | 100f | |
Mp | Prop<float> | 100f | |
MpMax | Prop<float> | 100f | |
Xp | Prop<float> | 0f | |
XpMax | Prop<float> | 100f | |
ShowMp | Prop<bool> | true | |
ShowXp | Prop<bool> | true |
插槽
没有插槽。
事件
没有公开事件。
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
sus-hud-player-statussus-hud-player-status__avatarsus-hud-player-status__barsus-hud-player-status__bar-labelsus-hud-player-status__barssus-hud-player-status__namesus-hud-player-status__row
用法
csharp
var status = new SusHudPlayerStatus();
status.PlayerName.Value = "Hero";
status.AvatarText.Value = "H";
status.AvatarImage.Value = "";
status.Hp.Value = 72f;
status.HpMax.Value = 100f;
status.Mp.Value = 40f;
status.MpMax.Value = 100f;
status.Xp.Value = 55f;
status.XpMax.Value = 100f;
status.ShowMp.Value = true;
status.ShowXp.Value = true;xml
<template>
<sus:SusHudPlayerStatus :PlayerName="Name.Value"
:AvatarImage="AvatarImg.Value"
:AvatarText="AvatarTxt.Value"
:Hp="Hp.Value"
:HpMax="HpMax.Value"
:Mp="Mp.Value"
:MpMax="MpMax.Value"
:Xp="Xp.Value"
:XpMax="XpMax.Value"
:ShowMp="ShowMp.Value"
:ShowXp="ShowXp.Value" />
</template>
<script>
public Prop<string> Name = new("Hero");
public Prop<string> AvatarImg = new("");
public Prop<string> AvatarTxt = new("H");
public Prop<float> Hp = new(72f);
public Prop<float> HpMax = new(100f);
public Prop<float> Mp = new(40f);
public Prop<float> MpMax = new(100f);
public Prop<float> Xp = new(55f);
public Prop<float> XpMax = new(100f);
public Prop<bool> ShowMp = new(true);
public Prop<bool> ShowXp = new(true);
</script>| Prop | 作用 |
|---|---|
PlayerName | 名称标签 |
AvatarImage | SusAvatar 使用的图片 URL / 资源 |
AvatarText | 后备字符;为空 → 使用 PlayerName |
Hp / HpMax | 生命值条 |
Mp / MpMax | 法力值条(ShowMp 为 false 时隐藏) |
Xp / XpMax | 经验值条(ShowXp 为 false 时隐藏) |
ShowMp · ShowXp | 切换 MP / XP 行的显示 |
备注
- 进度条会被限制在
[0, Max]范围内,且Max ≥ 1。 - 基于 kit 的
SusAvatar+SusProgressLinear构建 —— 主题令牌从 SusKit 级联而来。 - 需要世界空间追踪的单位铭牌时使用 SusUnitNameplate,而不是这个 HUD 区块。