using System.Collections.Generic;
|
using UnityEngine;
|
using LitJson;
|
|
// 武将信息:实际获得的武将,不包含图鉴数据
|
public partial class HeroInfo
|
{
|
// 武将配置表ID
|
public int heroId;
|
|
// 武将配置
|
public HeroConfig heroConfig;
|
public ItemModel itemHero; //引用背包里的 数据同步
|
|
public HeroCountry heroCountry
|
{
|
get
|
{
|
return (HeroCountry)heroConfig.Country;
|
}
|
}
|
|
|
//是否主线上阵 81 # 所在阵容信息列表 [阵容类型*10000+阵型类型*100+位置编号, ...]
|
public bool isInMainBattle
|
{
|
get
|
{
|
//从列表中找到 阵容为1的 主线阵容
|
var list = itemHero.GetUseData(81);
|
if (list != null && list.Count > 0)
|
{
|
var index = list.FindIndex((item) => item / 10000 == 1);
|
if (index >= 0)
|
{
|
return true;
|
}
|
}
|
return false;
|
}
|
}
|
|
// 优先功能提醒类型:1觉醒 2升级 3突破 4升星
|
// 优先顺序:
|
public int funcState
|
{
|
get
|
{
|
return 0;
|
}
|
}
|
|
public bool isLock
|
{
|
get
|
{
|
return itemHero.itemInfo.isLock;
|
}
|
}
|
|
|
|
public List<HeroFetterInfo> fetterInfoList = new List<HeroFetterInfo>();
|
public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>();
|
|
|
public HeroInfo(ItemModel _itemHero)
|
{
|
UpdateHero(_itemHero);
|
}
|
|
#if UNITY_EDITOR
|
public HeroInfo()
|
{
|
heroId = 520001; // 默认英雄ID
|
|
heroConfig = HeroConfig.Get(heroId);
|
qualityConfig = HeroQualityConfig.Get(Quality);
|
qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel);
|
CalculateProperties();
|
}
|
#endif
|
|
|
public void UpdateHero(ItemModel _itemHero)
|
{
|
itemHero = _itemHero;
|
// HeroConfigUtility
|
heroId = itemHero.config.ID;
|
|
|
InitConfigs();
|
// 71 # 英雄天赋ID列表
|
// List<int> talentSkillList = itemHero.GetUseData(71);
|
// // 73 # 英雄天赋ID等级列表,对应71天赋ID的等级
|
// List<int> talentLvList = itemHero.GetUseData(73);
|
// // 75 # 英雄天赋洗炼锁定索引列表,对应71天赋ID索引
|
// List<int> talentLockList = itemHero.GetUseData(75);
|
|
|
// if (talentLockList.Count != talentLvList.Count || talentLvList.Count != talentSkillList.Count)
|
// {
|
// Debug.LogError("天赋ID列表及后续的数据数量没对上");
|
// }
|
|
// // 天赋
|
// talentList.Clear();
|
// for (int i = 0; i < talentSkillList.Count; i++)
|
// {
|
// talentList.Add(new HeroTalentInfo(this, talentSkillList[i], talentLvList[i], talentLockList[i]));
|
// }
|
|
// // 羁绊
|
// fetterInfoList.Clear();
|
// for (int i = 0; i < heroConfig.FetterIDList.Length; i++)
|
// {
|
// fetterInfoList.Add(new HeroFetterInfo(this, heroConfig.FetterIDList[i]));
|
// }
|
|
// 77 # 英雄天赋洗炼随机ID列表
|
// 79 # 英雄觉醒时随机天赋选项ID列表
|
// 80 # 主阵型上阵位置
|
}
|
|
protected void InitConfigs()
|
{
|
// 武将配置
|
heroConfig = HeroConfig.Get(heroId);
|
|
|
// 品质配置
|
qualityConfig = HeroQualityConfig.Get(Quality);
|
|
// 品质突破配置
|
qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel);
|
|
}
|
|
public int GetInheritRate(HeroAttrType attrType)
|
{
|
return heroConfig.GetInheritPercent(attrType);
|
}
|
}
|