指挥官阵容获取方法

main
Yuntao Hu 2025-03-26 12:20:45 +08:00
parent 5c87423e2d
commit cf128700a4
1 changed files with 41 additions and 35 deletions

View File

@ -214,45 +214,51 @@ public class CharacterDataInfoManager : Singlenton<CharacterDataInfoManager>, II
public List<ProvideJob> GetCommanderProvideJobs(uint id)
{
var jobs = new List<ProvideJob>();
DataCharacterAttri cfg = null;
if (DataDic.TryGetValue(id, out var characterDataInfo))
{
if (characterDataInfo.Cfg.Job != Ejob.Job_Commander)
{
DebugUtil.LogError("该角色不为指挥官{0}", id);
return jobs;
}
var provideJobs = characterDataInfo.Cfg.ProvideJob;
if (provideJobs.Length == 0)
{
DebugUtil.LogError("该指挥官{0}推荐职位为空", id);
return jobs;
}
var vehicleList = new List<ProvideJob>();
var characterList = new List<ProvideJob>();
foreach (var job in provideJobs)
{
if (job == ProvideJob.ProvideJob_None)
{
DebugUtil.LogError("该指挥官{0}配置的推荐职业包含空");
continue;
}
if (job == ProvideJob.ProvideJob_Vehicle)
{
vehicleList.Add(job);
}
else
{
characterList.Add(job);
}
}
jobs.AddRange(vehicleList);
jobs.AddRange(characterList);
cfg = characterDataInfo.Cfg;
}
else
{
cfg = TableManager.Instance.Tables.CharacterAttri.GetOrDefault((int)id);
}
if (cfg.Job != Ejob.Job_Commander)
{
DebugUtil.LogError("该角色不为指挥官{0}", id);
return jobs;
}
var provideJobs = cfg.ProvideJob;
if (provideJobs.Length == 0)
{
DebugUtil.LogError("该指挥官{0}推荐职位为空", id);
return jobs;
}
var vehicleList = new List<ProvideJob>();
var characterList = new List<ProvideJob>();
foreach (var job in provideJobs)
{
if (job == ProvideJob.ProvideJob_None)
{
DebugUtil.LogError("该指挥官{0}配置的推荐职业包含空");
continue;
}
if (job == ProvideJob.ProvideJob_Vehicle)
{
vehicleList.Add(job);
}
else
{
characterList.Add(job);
}
}
jobs.AddRange(vehicleList);
jobs.AddRange(characterList);
return jobs;
}