86 lines
3.1 KiB
C#
86 lines
3.1 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年09月05日 星期五 16:09:49
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System.Collections.Generic;
|
|
using Logic.HeroTask;
|
|
using Logic.Skill;
|
|
using RuntimeData;
|
|
|
|
|
|
namespace TH1_Logic.HeroTask
|
|
{
|
|
public class HeroTaskManager
|
|
{
|
|
public static HeroTaskManager Instance = new HeroTaskManager();
|
|
private HeroTaskData _data;
|
|
|
|
|
|
public void Init()
|
|
{
|
|
_data = new HeroTaskData();
|
|
for (int i = (int)GiantType.None; i <= (int)GiantType.IndianRin; i++)
|
|
{
|
|
if (!Table.Instance.HeroDataAssets.GetHeroInfo((GiantType)i, out var info)) continue;
|
|
for (int j = 0; j < info.TaskList.Count; j++)
|
|
{
|
|
var content = HeroTaskFactory.GetHeroTaskContentBase(info.TaskList[j].taskContentType);
|
|
content.TargetLevel = info.TaskList[j].Param;
|
|
content.SkillType = info.TaskList[j].SkillParam;
|
|
content.SpType = info.TaskList[j].SpType;
|
|
|
|
content.UnitFullTypes ??= new List<UnitFullType>();
|
|
content.UnitFullTypes.Clear();
|
|
foreach (var target in info.TaskList[j].UnitFullTypes) content.UnitFullTypes.Add(target);
|
|
|
|
content.TargetTypes ??= new List<SanaeDivineType>();
|
|
content.TargetTypes.Clear();
|
|
foreach (var target in info.TaskList[j].TargetBuff) content.TargetTypes.Add(target);
|
|
content.SkillTypeList ??= new List<SkillType>();
|
|
content.SkillTypeList.Clear();
|
|
foreach (var skillType in info.TaskList[j].SkillList) content.SkillTypeList.Add(skillType);
|
|
|
|
var item = new HeroTaskItem();
|
|
item.UnitType = UnitType.Giant;
|
|
item.GiantType = (GiantType)i;
|
|
item.Level = (uint)(j + 1);
|
|
item.Content = content;
|
|
_data.Items.Add(item);
|
|
}
|
|
}
|
|
}
|
|
|
|
public HeroTaskContentBase GetHeroTaskContent(UnitData unit)
|
|
{
|
|
if (_data == null) return null;
|
|
foreach (var item in _data.Items)
|
|
{
|
|
if(item.UnitType != unit.UnitType) continue;
|
|
if(item.GiantType != unit.GiantType) continue;
|
|
if(item.Level != unit.UnitLevel) continue;
|
|
return item.GetCopyHeroTaskContentBase();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public bool GetHeroTaskContent(UnitFullType type,out HeroTaskContentBase task)
|
|
{
|
|
task = null;
|
|
if (_data == null) return false;
|
|
foreach (var item in _data.Items)
|
|
{
|
|
if(item.UnitType != type.UnitType) continue;
|
|
if(item.GiantType != type.GiantType) continue;
|
|
if(item.Level != type.UnitLevel) continue;
|
|
task = item.GetCopyHeroTaskContentBase();
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
} |