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

70 lines
1.9 KiB
C#
Raw Normal View History

2025-02-18 16:51:48 +08:00
using cfg.ActorCfg;
2025-02-18 19:13:41 +08:00
using cfg.VehicleCfg;
2025-02-18 16:51:48 +08:00
using Framework;
using NLDPB;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
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>
public int ID { get; private set; }
/// <summary>
/// 等级
/// </summary>
public int Level { get; private set; }
/// <summary>
/// 图标
/// </summary>
public string IconPath { get; private set; }
/// <summary>
/// 类型
/// </summary>
public ItemType Type { get; private set; }
2025-02-18 19:13:41 +08:00
public LegionRoleData(int 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
DataItem dataItem = TableManager.Instance.Tables.Item.Get(ID);
if (null == dataItem)
{
DebugUtil.LogError($"(军团战)没有ID为{ID}的角色或载具");
return;
}
Type = dataItem.Type;
switch (Type)
{
case ItemType.Character:
{
IconPath = CommonUtils.GetDefaultHeadPathByUid((uint)ID);
}
break;
case ItemType.Vehicle:
{
2025-02-18 19:13:41 +08:00
DataVehicle dataVehicle = TableManager.Instance.Tables.VehicleConfig.Get(ID);
if (null != dataVehicle)
Level = dataVehicle.VehicleLevel;
2025-02-18 16:51:48 +08:00
IconPath = CommonUtils.GetDefaultVehicleHeadPath((uint)ID);
}
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
}
}