NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/LegionBattle/Data/LegionRoleData.cs

74 lines
2.2 KiB
C#
Raw Normal View History

2025-02-18 16:51:48 +08:00
using cfg.ActorCfg;
using cfg.CharacterCfg;
2025-02-18 19:13:41 +08:00
using cfg.VehicleCfg;
2025-02-18 16:51:48 +08:00
using Framework;
using NLDPB;
namespace Gameplay.LegionBattle
{
/// <summary>
/// 军团战角色数据
/// </summary>
2025-02-18 19:13:41 +08:00
public sealed class LegionRoleData
2025-02-18 16:51:48 +08:00
{
/// <summary>
/// 角色的id
/// </summary>
2025-03-13 19:10:04 +08:00
public uint ID { get; private set; }
2025-02-18 16:51:48 +08:00
/// <summary>
/// 等级
/// </summary>
public int Level { get; private set; }
/// <summary>
/// 图标
/// </summary>
public string IconPath { get; private set; }
/// <summary>
/// 职业类型
/// </summary>
public Ejob Job { get; private set; }
/// <summary>
2025-02-18 16:51:48 +08:00
/// 类型
/// </summary>
public ItemType Type { get; private set; }
2025-03-13 19:10:04 +08:00
public LegionRoleData(uint id)
2025-02-18 16:51:48 +08:00
{
2025-02-18 19:13:41 +08:00
ID = id;
2025-02-18 16:51:48 +08:00
2025-03-13 19:10:04 +08:00
DataItem dataItem = TableManager.Instance.Tables.Item.Get((int)ID);
2025-02-18 16:51:48 +08:00
if (null == dataItem)
{
DebugUtil.LogError($"(军团战)没有ID为{ID}的角色或载具");
return;
}
Type = dataItem.Type;
switch (Type)
{
case ItemType.Character:
{
2025-03-13 19:10:04 +08:00
IconPath = CommonUtils.GetDefaultHeadPathByUid(ID);
DataCharacterAttri dataCharacterAttri = TableManager.Instance.Tables.CharacterAttri.Get((int)ID);
if (null != dataCharacterAttri)
Job = dataCharacterAttri.Job;
2025-02-18 16:51:48 +08:00
}
break;
case ItemType.Vehicle:
{
Job = Ejob.Job_Vehicle;
2025-03-13 19:10:04 +08:00
DataVehicle dataVehicle = TableManager.Instance.Tables.VehicleConfig.Get((int)ID);
2025-02-18 19:13:41 +08:00
if (null != dataVehicle)
Level = dataVehicle.VehicleLevel;
2025-03-13 19:10:04 +08:00
IconPath = CommonUtils.GetDefaultVehicleHeadPath(ID);
2025-02-18 16:51:48 +08:00
}
break;
}
}
2025-02-18 19:13:41 +08:00
public void CopyData(MSG_LB_Character data)
{
Level = (int)data.Level;
}
2025-02-18 16:51:48 +08:00
}
}