| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | using log4net.Core; |
| | | |
| | | // 武将信息:实际获得的武将,不包含图鉴数据 |
| | | public partial class HeroInfo |
| | | { |
| | | // 武将服务器唯一ID |
| | | public long sid; |
| | | |
| | | // 武将配置表ID |
| | | public int heroId; |
| | | |
| | | // 武将等级 |
| | | public int heroLevel; |
| | | |
| | | // 武将星级 |
| | | public int heroStar; |
| | | |
| | | // 武将突破等级 |
| | | public int breakLevel; |
| | | |
| | | // 武将觉醒等级 |
| | | public int awakeLevel; |
| | | |
| | | // 武将配置 |
| | | public HeroConfig heroConfig; |
| | | public ItemModel itemHero; //引用背包里的 数据同步 |
| | | |
| | | public HeroCountry heroCountry |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public int Quality |
| | | |
| | | // 优先功能提醒类型:1觉醒 2升级 3突破 4升星 |
| | | // 优先顺序: |
| | | public int funcState |
| | | { |
| | | get |
| | | { |
| | | return heroConfig.Quality; |
| | | return 0; |
| | | } |
| | | } |
| | | // public readonly CB122_tagSCHeroInfo.tagSCHero scHeroInfo; |
| | | |
| | | // 武将配置 |
| | | public HeroConfig heroConfig; |
| | | // 觉醒配置 |
| | | public HeroAwakeConfig awakeConfig; |
| | | // 突破配置 |
| | | public HeroBreakConfig breakConfig; |
| | | // 羁绊配置 |
| | | public HeroFetterConfig fetterConfig; |
| | | // 品质觉醒配置 |
| | | public HeroQualityAwakeConfig qualityAwakeConfig; |
| | | // 品质配置 |
| | | public HeroQualityConfig qualityConfig; |
| | | // 品质突破配置 |
| | | public HeroQualityBreakConfig qualityBreakConfig; |
| | | public bool isLock |
| | | { |
| | | get |
| | | { |
| | | return itemHero.itemInfo.isLock; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public List<HeroFetterInfo> fetterInfoList = new List<HeroFetterInfo>(); |
| | | public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>(); |
| | | |
| | | |
| | | public HeroInfo(/*CB122_tagSCHeroInfo.tagSCHero _scHeroInfo, */ItemModel _itemHero) |
| | | public HeroInfo(ItemModel _itemHero) |
| | | { |
| | | // scHeroInfo = _scHeroInfo; |
| | | UpdateHero(_itemHero); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | public HeroInfo(HB424_tagSCTurnFightInit.tagSCTurnFightObj fightObj) |
| | | { |
| | | // 战斗表现需要这些基本就够 不够还需要服务器加 |
| | | |
| | | heroId = (int)fightObj.HeroID; |
| | | heroConfig = HeroConfig.Get(heroId); |
| | | SkinID = (int)fightObj.SkinID; |
| | | skinConfig = HeroSkinConfig.Get(SkinID); |
| | | heroLevel = (int)fightObj.LV; |
| | | } |
| | | |
| | | #if UNITY_EDITOR |
| | | #if UNITY_EDITOR |
| | | public HeroInfo() |
| | | { |
| | | heroId = 520001; // 默认英雄ID |
| | | heroLevel = 1; |
| | | heroStar = 1; |
| | | breakLevel = 1; |
| | | awakeLevel = 1; |
| | | SkinIndex = 0; |
| | | |
| | | heroConfig = HeroConfig.Get(heroId); |
| | | awakeConfig = HeroAwakeConfig.GetHeroAwakeConfig(heroId, awakeLevel); |
| | | breakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, breakLevel); |
| | | qualityAwakeConfig = HeroQualityAwakeConfig.GetQualityAwakeConfig(Quality, awakeLevel); |
| | | qualityConfig = HeroQualityConfig.Get(Quality); |
| | | qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel); |
| | | CalculateProperties(); |
| | | } |
| | | #endif |
| | | |
| | | // public HeroInfo Clone() => JsonMapper.ToObject<HeroInfo>(JsonMapper.ToJson(this)); |
| | | #endif |
| | | |
| | | |
| | | public void UpdateHero(ItemModel itemHero) |
| | | public void UpdateHero(ItemModel _itemHero) |
| | | { |
| | | itemHero = _itemHero; |
| | | // HeroConfigUtility |
| | | heroId = itemHero.config.ID; |
| | | // 70 # 英雄等级 |
| | | heroLevel = itemHero.GetUseData(70)[0]; |
| | | // 72 # 英雄星级 |
| | | heroStar = itemHero.GetUseData(72)[0]; |
| | | // 74 # 英雄突破等级 |
| | | breakLevel = itemHero.GetUseData(74)[0]; |
| | | // 76 # 英雄觉醒等级 |
| | | awakeLevel = itemHero.GetUseData(76)[0]; |
| | | // 78 # 英雄使用的皮肤索引 |
| | | SkinIndex = itemHero.GetUseData(78)[0]; |
| | | |
| | | |
| | | // 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); |
| | | |
| | | 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])); |
| | | } |
| | | // if (talentLockList.Count != talentLvList.Count || talentLvList.Count != talentSkillList.Count) |
| | | // { |
| | | // Debug.LogError("天赋ID列表及后续的数据数量没对上"); |
| | | // } |
| | | |
| | | // 羁绊 |
| | | fetterInfoList.Clear(); |
| | | for (int i = 0; i < heroConfig.FetterIDList.Length; i++) |
| | | { |
| | | fetterInfoList.Add(new HeroFetterInfo(this, heroConfig.FetterIDList[i])); |
| | | } |
| | | // // 天赋 |
| | | // talentList.Clear(); |
| | | // for (int i = 0; i < talentSkillList.Count; i++) |
| | | // { |
| | | // talentList.Add(new HeroTalentInfo(this, talentSkillList[i], talentLvList[i], talentLockList[i])); |
| | | // } |
| | | |
| | | // 77 # 英雄天赋洗炼随机ID列表 |
| | | // 79 # 英雄觉醒时随机天赋选项ID列表 |
| | | // 80 # 主阵型上阵位置 |
| | | // // 羁绊 |
| | | // 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); |
| | | |
| | | // 觉醒配置 (满级为空) |
| | | awakeConfig = HeroAwakeConfig.GetHeroAwakeConfig(heroId, awakeLevel); |
| | | |
| | | // 突破配置 |
| | | breakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, breakLevel); |
| | | |
| | | // 羁绊配置 可能需要fetterid 去检索效率太低 |
| | | // fetterConfig; |
| | | |
| | | // 品质觉醒配置 |
| | | qualityAwakeConfig = HeroQualityAwakeConfig.GetQualityAwakeConfig(Quality, awakeLevel); |
| | | |
| | | // 品质配置 |
| | | qualityConfig = HeroQualityConfig.Get(Quality); |
| | |
| | | { |
| | | return heroConfig.GetInheritPercent(attrType); |
| | | } |
| | | |
| | | //是否上x阵 81 # 所在阵容信息列表 [阵容类型*10000+阵型类型*100+位置编号, ...] |
| | | public bool IsInTeamByTeamType(TeamType teamType) |
| | | { |
| | | var list = itemHero.GetUseData(81); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | var index = list.FindIndex((item) => item / 10000 == (int)teamType); |
| | | if (index >= 0) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |