Files
ft/Client/Assets/Scripts/UI/PartnerGather/PlayerInfo.cs
2026-06-29 21:18:33 +08:00

49 lines
1.3 KiB
C#

using Newtonsoft.Json;
public class PlayerInfo
{
public string PlayFabId { get; set; }
public string DisplayName { get; set; }
public string AvatarUrl { get; set; }
public int Level { get; set; }
public PlayerInfo() { }
[JsonConstructor]
public PlayerInfo(string playFabId, string displayName, string avatarUrl, int level)
{
PlayFabId = playFabId;
DisplayName = displayName;
AvatarUrl = avatarUrl;
Level = level;
}
public static PlayerInfo Default => new PlayerInfo
{
PlayFabId = "000000000000000000000",
DisplayName = "Angler#",
AvatarUrl = "",
Level = 200
};
public static PlayerInfo FromScrollViewItem(EventPartnerScrollViewItem.ScrollViewItemInfo info)
{
return new PlayerInfo
{
PlayFabId = info.PlayfabId,
DisplayName = info.DisplayName,
AvatarUrl = info.AvatarUrl,
Level = info.Level,
};
}
public EventPartnerScrollViewItem.ScrollViewItemInfo ToScrollViewItemInfo(EventPartnerScrollViewItem.EScrollViewType type)
{
return new EventPartnerScrollViewItem.ScrollViewItemInfo
{
PlayfabId = PlayFabId,
DisplayName = DisplayName,
AvatarUrl = AvatarUrl,
Level = Level,
Type = type
};
}
}