跳转到内容

SusProfileScreenContent

SusProfileScreenContent

玩家资料面板 — 头像、name/rank 芯片、wins/matches/K-D、通过 SetFriends 提供的好友列表、编辑门控。

SusGame · 屏幕(商业)

在 Playground 中打开

SusGame · Screens

属性

名称类型默认值
DisplayNameProp<string>"Player"
AvatarImageProp<string>""
AvatarStatusProp<string>""
LevelProp<int>1
XpProp<int>0
RankProp<string>"Recruit"
WinsProp<int>0
MatchesProp<int>0
KdProp<float>0f
CanEditProp<bool>true

插槽

没有插槽。

事件

名称字段载荷
FriendClickedOnFriendClickedstring

样式钩子

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

  • sus-chip__text
  • sus-profile-screen
  • sus-profile-screen__friend
  • sus-profile-screen__friend-av
  • sus-profile-screen__friend-name
  • sus-profile-screen__friend-status
  • sus-profile-screen__friends
  • sus-profile-screen__id-col
  • sus-profile-screen__identity
  • sus-profile-screen__name
  • sus-profile-screen__rank
  • sus-profile-screen__rank-row
  • sus-profile-screen__stat
  • sus-profile-screen__stats
  • sus-profile-screen__top

用法

绑定身份/统计 props;通过 SetFriends 推送好友数据。为 BackBtn / EditBtn / OnFriendClicked 接线。

xml
<template>
  <sus:SusProfileScreenContent
    :DisplayName="Name.Value"
    :AvatarImage="AvatarImg.Value"
    :AvatarStatus="Status.Value"
    :Level="Lvl.Value"
    :Rank="Rank.Value"
    :Wins="Wins.Value"
    :Matches="Matches.Value"
    :Kd="Kd.Value"
    :CanEdit="Edit.Value"
  />
</template>

<script>
public Prop<string> Name = new("Player");
public Prop<string> AvatarImg = new("");
public Prop<string> Status = new("online");
public Prop<int> Lvl = new(1);
public Prop<string> Rank = new("Recruit");
public Prop<int> Wins = new(0);
public Prop<int> Matches = new(0);
public Prop<float> Kd = new(0f);
public Prop<bool> Edit = new(true);
</script>
csharp
var profile = new SusProfileScreenContent();
profile.DisplayName.Value = "Nova";
profile.Level.Value = 12;
profile.Rank.Value = "Veteran";
profile.Wins.Value = 40;
profile.Matches.Value = 55;
profile.Kd.Value = 1.25f;
profile.CanEdit.Value = true;
profile.SetFriends(new List<SusProfileScreenContent.FriendRow> {
  new() { Id = "u1", Name = "Ally", Status = "online" },
  new() { Id = "u2", Name = "Rival", Status = "offline" },
});
profile.OnFriendClicked += id => { /* open friend */ };
profile.BackBtn.OnClick += () => { /* back */ };
profile.EditBtn.OnClick += () => { /* edit flow */ };
Prop / APIRole
DisplayName名称芯片 + 头像文本
AvatarImage / AvatarStatus头像图片 URL / 状态
Level / RankRank 行芯片
Wins / Matches / Kd统计芯片
Xp已声明的 Prop<int> — 当前 pin 未在 UI 中显示
CanEdit为 false 时禁用 EditBtn
SetFriends(List<FriendRow>)重建好友行(Id/Name/Status/AvatarIcon
OnFriendClickedAction<string>(id 或 name)
BackBtn / EditBtn / FriendsHost宿主接线

备注

  • 好友列表为空时通过 EmptyFriends 显示「No friends yet.」。
  • FriendRow.Status 会转为小写用作头像状态;online 还会为状态标签着色。
  • 存在于 SusGame pin 中 — 类型是真实的(SusProfileScreenContent / 嵌套的 FriendRow)。