117 【武将】武将系统 武将的属性部分 部分战斗的内容
| | |
| | | |
| | | public class EventName |
| | | { |
| | | public const string BATTLE_ACTION_OVER = "BATTLE_ACTION_OVER"; //战斗 行为结束了(一个战报播完) |
| | | |
| | | |
| | | } |
| | |
| | | Debug.LogError(typeof(T).Name + " 重复的key " + key + " " + exception.Message);
|
| | | }
|
| | | #endif
|
| | | |
| | | }
|
| | |
|
| | | foreach (var cfg in dic.Values)
|
| | | {
|
| | | cfg.AllConfigLoadFinish();
|
| | | }
|
| | |
|
| | | isInit = true;
|
| | |
| | | return default(U);
|
| | | }
|
| | |
|
| | | protected virtual void AllConfigLoadFinish()
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | public virtual void LoadConfig(string line)
|
| | | {
|
| | |
|
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: YYL |
| | | // [ Date ]: 2025年6月13日 |
| | | // [ Date ]: 2025年6月16日 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Collections.Generic; |
| | |
| | | public int DefInheritPer; |
| | | public int HPInheritPer; |
| | | public string BatAttrDict; |
| | | public int[] FetterIDList; |
| | | |
| | | public override int LoadKey(string _key) |
| | | { |
| | |
| | | int.TryParse(tables[8],out HPInheritPer); |
| | | |
| | | BatAttrDict = tables[9]; |
| | | |
| | | if (tables[10].Contains("[")) |
| | | { |
| | | FetterIDList = JsonMapper.ToObject<int[]>(tables[10]); |
| | | } |
| | | else |
| | | { |
| | | string[] FetterIDListStringArray = tables[10].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | FetterIDList = new int[FetterIDListStringArray.Length]; |
| | | for (int i=0;i<FetterIDListStringArray.Length;i++) |
| | | { |
| | | int.TryParse(FetterIDListStringArray[i],out FetterIDList[i]); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception exception) |
| | | { |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: YYL |
| | | // [ Date ]: 2025年6月13日 |
| | | // [ Date ]: 2025年6月16日 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Collections.Generic; |
New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: YYL |
| | | // [ Date ]: 2025年6月13日 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Threading; |
| | | using System; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | public partial class HeroAwakeConfig : ConfigBase<int, HeroAwakeConfig> |
| | | { |
| | | // public int HeroID; |
| | | // public int AwakeLV; |
| | | |
| | | // HeroID, Dictionary<AwakeLV, HeroAwakeConfig> |
| | | public static Dictionary<int, Dictionary<int, HeroAwakeConfig>> configDics = new Dictionary<int, Dictionary<int, HeroAwakeConfig>>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | |
| | | Dictionary<int, HeroAwakeConfig> tempDic = null; |
| | | |
| | | if (!configDics.TryGetValue(HeroID, out tempDic)) |
| | | { |
| | | tempDic = new Dictionary<int, HeroAwakeConfig>(); |
| | | configDics.Add(HeroID, tempDic); |
| | | } |
| | | |
| | | if (tempDic.ContainsKey(AwakeLV)) |
| | | { |
| | | // 覆盖,防止二次初始化出错 |
| | | tempDic[AwakeLV] = this; |
| | | } |
| | | else |
| | | { |
| | | tempDic.Add(AwakeLV, this); |
| | | } |
| | | } |
| | | |
| | | public static HeroAwakeConfig GetHeroAwakeConfig(int heroID, int awakeLv) |
| | | { |
| | | Dictionary<int, HeroAwakeConfig> tempDic = null; |
| | | |
| | | if (!configDics.TryGetValue(heroID, out tempDic)) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | HeroAwakeConfig config = null; |
| | | tempDic.TryGetValue(awakeLv, out config); |
| | | |
| | | return config; |
| | | } |
| | | |
| | | public static bool IsReachMax(int heroID, int awakeLv) |
| | | { |
| | | return GetHeroAwakeConfig(heroID, awakeLv) == null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e524a2adfe4b6e24dbde99544124292c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public partial class HeroBreakConfig : ConfigBase<int, HeroBreakConfig> |
| | | { |
| | | // public int HeroID; |
| | | // public int BreakLV; |
| | | |
| | | // HeroID, Dictionary<BreakLV, HeroBreakConfig> |
| | | public static Dictionary<int, Dictionary<int, HeroBreakConfig>> configDics = new Dictionary<int, Dictionary<int, HeroBreakConfig>>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | |
| | | Dictionary<int, HeroBreakConfig> tempDic = null; |
| | | if (!configDics.TryGetValue(HeroID, out tempDic)) |
| | | { |
| | | tempDic = new Dictionary<int, HeroBreakConfig>(); |
| | | configDics.Add(HeroID, tempDic); |
| | | } |
| | | |
| | | if (tempDic.ContainsKey(BreakLV)) |
| | | { |
| | | tempDic[BreakLV] = this; |
| | | } |
| | | else |
| | | { |
| | | tempDic.Add(BreakLV, this); |
| | | } |
| | | } |
| | | |
| | | public static HeroBreakConfig GetHeroBreakConfig(int heroID, int breakLv) |
| | | { |
| | | Dictionary<int, HeroBreakConfig> tempDic = null; |
| | | if (!configDics.TryGetValue(heroID, out tempDic)) |
| | | { |
| | | return null; |
| | | } |
| | | HeroBreakConfig config = null; |
| | | tempDic.TryGetValue(breakLv, out config); |
| | | return config; |
| | | } |
| | | |
| | | public static bool IsReachMax(int heroID, int breakLv) |
| | | { |
| | | return GetHeroBreakConfig(heroID, breakLv) == null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a263d1f9613456e4bbea60e3fcb19d2e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | public partial class HeroConfig : ConfigBase<int, HeroConfig> |
| | | { |
| | | public Dictionary<HeroAttrType, int> inheritPropertiesDict = new Dictionary<HeroAttrType, int>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | |
| | | inheritPropertiesDict.Clear(); |
| | | |
| | | inheritPropertiesDict.Add(HeroAttrType.attack, AtkInheritPer); |
| | | inheritPropertiesDict.Add(HeroAttrType.defense, DefInheritPer); |
| | | inheritPropertiesDict.Add(HeroAttrType.hp, HPInheritPer); |
| | | |
| | | |
| | | // json格式 |
| | | // {"属性ID":值, ...} |
| | | // 属性ID对应属性条目表的ID |
| | | // 有值的配即可,没有配置的属性默认0 |
| | | JsonData jsonData = JsonMapper.ToObject(BatAttrDict); |
| | | |
| | | foreach (var attrId in jsonData.Keys) |
| | | { |
| | | if (int.TryParse(attrId.ToString(), out int attrTypeId)) |
| | | { |
| | | HeroAttrType attrType = (HeroAttrType)attrTypeId; |
| | | if (jsonData[attrId] != null && int.TryParse(jsonData[attrId].ToString(), out int value)) |
| | | { |
| | | if (inheritPropertiesDict.ContainsKey(attrType)) |
| | | { |
| | | Debug.LogError($"HeroTalentConfig: 属性 {attrType} 已经存在,无法重复添加。请检查配置文件。"); |
| | | } |
| | | else |
| | | { |
| | | inheritPropertiesDict.Add(attrType, value); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public int GetInheritPercent(HeroAttrType attrType) |
| | | { |
| | | if (inheritPropertiesDict.TryGetValue(attrType, out int perc)) |
| | | { |
| | | return perc; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: dd269c7c73dcf3f4f87848b25f007405 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Threading; |
| | | using System; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | public partial class HeroFetterConfig : ConfigBase<int, HeroFetterConfig> |
| | | { |
| | | private Dictionary<HeroAttrType, int> attrValues = new Dictionary<HeroAttrType, int>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | |
| | | // public int[] AttrIDList; |
| | | // public int[] AttrValueList; |
| | | |
| | | if (AttrIDList.Length != AttrValueList.Length) |
| | | { |
| | | Debug.LogError("HeroFetterConfig 配置错误 " + FetterID); |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0; i < AttrIDList.Length; i++) |
| | | { |
| | | HeroAttrType attrType = (HeroAttrType)AttrIDList[i]; |
| | | if (attrValues.ContainsKey(attrType)) |
| | | { |
| | | Debug.LogError("HeroFetterConfig 配置错误 " + FetterID); |
| | | return; |
| | | } |
| | | |
| | | attrValues.Add((HeroAttrType)AttrIDList[i], AttrValueList[i]); |
| | | } |
| | | } |
| | | |
| | | public int GetFetterAttr(HeroAttrType attrType) |
| | | { |
| | | if (attrValues.TryGetValue(attrType, out int value)) |
| | | { |
| | | return value; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4a3ad59499e2d754d869070e775fd250 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Threading; |
| | | using System; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | public partial class HeroQualityAwakeConfig : ConfigBase<int, HeroQualityAwakeConfig> |
| | | { |
| | | |
| | | // Quality, Dictionary<AwakeLV, UPCostItem> |
| | | public static Dictionary<int, Dictionary<int, HeroQualityAwakeConfig>> costDics = new Dictionary<int, Dictionary<int, HeroQualityAwakeConfig>>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | |
| | | Dictionary<int, HeroQualityAwakeConfig> tempDic = null; |
| | | |
| | | if (!costDics.TryGetValue(Quality, out tempDic)) |
| | | { |
| | | tempDic = new Dictionary<int, HeroQualityAwakeConfig>(); |
| | | } |
| | | |
| | | |
| | | if (tempDic.ContainsKey(AwakeLV)) |
| | | { |
| | | // 覆盖 这里怕有代码写错 二次初始化配置 导致出问题 |
| | | // 当是防错 性能上也不算太耗 因为表就没多少数据 |
| | | tempDic[AwakeLV] = this; |
| | | } |
| | | else |
| | | { |
| | | tempDic.Add(AwakeLV, this); |
| | | } |
| | | } |
| | | |
| | | public static HeroQualityAwakeConfig GetQualityAwakeConfig(int quality, int awakeLv) |
| | | { |
| | | Dictionary<int, HeroQualityAwakeConfig> tempDic = null; |
| | | |
| | | if (!costDics.TryGetValue(quality, out tempDic)) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | HeroQualityAwakeConfig config = null; |
| | | |
| | | tempDic.TryGetValue(awakeLv, out config); |
| | | |
| | | return config; |
| | | } |
| | | |
| | | public static bool IsReachMax(int quality, int awakeLv) |
| | | { |
| | | return GetQualityAwakeConfig(quality, awakeLv) == null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6fcabb6f5d955a048b40024428c7b510 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public partial class HeroQualityBreakConfig : ConfigBase<int, HeroQualityBreakConfig> |
| | | { |
| | | // public int Quality; |
| | | // public int BreakLV; |
| | | |
| | | // Quality, Dictionary<BreakLV, HeroQualityBreakConfig> |
| | | public static Dictionary<int, Dictionary<int, HeroQualityBreakConfig>> configDics = new Dictionary<int, Dictionary<int, HeroQualityBreakConfig>>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | |
| | | Dictionary<int, HeroQualityBreakConfig> tempDic = null; |
| | | if (!configDics.TryGetValue(Quality, out tempDic)) |
| | | { |
| | | tempDic = new Dictionary<int, HeroQualityBreakConfig>(); |
| | | configDics.Add(Quality, tempDic); |
| | | } |
| | | |
| | | if (tempDic.ContainsKey(BreakLV)) |
| | | { |
| | | tempDic[BreakLV] = this; |
| | | } |
| | | else |
| | | { |
| | | tempDic.Add(BreakLV, this); |
| | | } |
| | | } |
| | | |
| | | public static HeroQualityBreakConfig GetQualityBreakConfig(int quality, int breakLv) |
| | | { |
| | | Dictionary<int, HeroQualityBreakConfig> tempDic = null; |
| | | if (!configDics.TryGetValue(quality, out tempDic)) |
| | | { |
| | | return null; |
| | | } |
| | | HeroQualityBreakConfig config = null; |
| | | tempDic.TryGetValue(breakLv, out config); |
| | | return config; |
| | | } |
| | | |
| | | public static bool IsReachMax(int quality, int breakLv) |
| | | { |
| | | return GetQualityBreakConfig(quality, breakLv) == null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4ebc71d06bf0df04d8696b6a41f1199c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public partial class HeroTalentConfig : ConfigBase<int, HeroTalentConfig> |
| | | { |
| | | // public int Quality; |
| | | // public int AttrID; |
| | | |
| | | // Quality, List<HeroTalentConfig> |
| | | public static Dictionary<int, List<HeroTalentConfig>> configDics = new Dictionary<int, List<HeroTalentConfig>>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | |
| | | List<HeroTalentConfig> list = null; |
| | | if (!configDics.TryGetValue(Quality, out list)) |
| | | { |
| | | list = new List<HeroTalentConfig>(); |
| | | configDics.Add(Quality, list); |
| | | } |
| | | list.Add(this); |
| | | } |
| | | |
| | | public static List<HeroTalentConfig> GetTalentListByQuality(int quality) |
| | | { |
| | | List<HeroTalentConfig> list = null; |
| | | if (configDics.TryGetValue(quality, out list)) |
| | | { |
| | | return list; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 所有品质的列表按AttrID升序排序(需在所有配置加载完后调用一次) |
| | | /// </summary> |
| | | public static void SortAllByAttrID() |
| | | { |
| | | foreach (var pair in configDics) |
| | | { |
| | | pair.Value.Sort((a, b) => a.AttrID.CompareTo(b.AttrID)); |
| | | } |
| | | } |
| | | |
| | | protected override void AllConfigLoadFinish() |
| | | { |
| | | base.AllConfigLoadFinish(); |
| | | // 排序 |
| | | SortAllByAttrID(); |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a74ae0573fd8447429167015504998af |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | |
| | | public class BattleField |
| | | { |
| | | protected int battleId = 0; |
| | | |
| | | public BattleMode battleMode; |
| | | |
| | | public BattleObjMgr battleObjMgr; |
| | |
| | | |
| | | public int round = 0; |
| | | |
| | | public BattleField() |
| | | public virtual void Init(TeamBase _redTeam, TeamBase _blueTeam) |
| | | { |
| | | |
| | | } |
| | | |
| | | public void Init(int _battleId, int _levelId, BattleMode _battleMode, TeamBase _redTeam, TeamBase _blueTeam = null) |
| | | { |
| | | battleId = _battleId; |
| | | battleMode = _battleMode; |
| | | |
| | | battleObjMgr = new BattleObjMgr(); |
| | | battleObjMgr.Init(_levelId, _redTeam, _blueTeam); |
| | | battleObjMgr.Init(_redTeam, _blueTeam); |
| | | |
| | | recordPlayer = new RecordPlayer(); |
| | | recordPlayer.Init(this); |
| | | } |
| | | |
| | | public void Release() |
| | | public virtual void Release() |
| | | { |
| | | battleObjMgr.Release(); |
| | | } |
| | | |
| | | public void Run() |
| | | public virtual void Run() |
| | | { |
| | | recordPlayer.Run(); |
| | | battleObjMgr.Run(); |
| | |
| | | battleMode = _battleMode; |
| | | } |
| | | |
| | | public void PlayRecord(RecordAction recordAction) |
| | | public virtual void PlayRecord(RecordAction recordAction) |
| | | { |
| | | recordPlayer.PlayRecord(recordAction); |
| | | } |
| | | |
| | | public void PlayRecord(List<RecordAction> recordList) |
| | | public virtual void PlayRecord(List<RecordAction> recordList) |
| | | { |
| | | recordPlayer.PlayRecord(recordList); |
| | | } |
| | | |
| | | public void OnActionOver(int attackId) |
| | | public virtual void OnActionOver(int attackId) |
| | | { |
| | | // |
| | | // 手动推点一下发一个包 收一个包 播放一次报文 之后就停住 直到战斗结束的包文 |
| | |
| | | } |
| | | } |
| | | |
| | | public void StartGame() |
| | | public virtual void ResumeGame() |
| | | { |
| | | recordPlayer.StartGame(); |
| | | battleObjMgr.ResumeGame(); |
| | | } |
| | | |
| | | public virtual void PauseGame() |
| | | { |
| | | battleObjMgr.PauseGame(); |
| | | } |
| | | } |
New file |
| | |
| | | |
| | | |
| | | using System; |
| | | |
| | | public class StoryBattleField : BattleField |
| | | { |
| | | public override void Init(TeamBase _redTeam, TeamBase _blueTeam) |
| | | { |
| | | string savedStr = LocalSave.GetString("StoryBattleFieldBattleMode"); |
| | | if (string.IsNullOrEmpty(savedStr)) |
| | | { |
| | | savedStr = "Hand"; |
| | | } |
| | | battleMode = (BattleMode)Enum.Parse(typeof(BattleMode), savedStr); |
| | | |
| | | base.Init(_redTeam, _blueTeam); |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6679c13aebc8e5a48afaa1001b4656f8 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | |
| | | public class BattleManager : GameSystemManager<BattleManager> |
| | | { |
| | | protected Dictionary<int, BattleField> battleFields = new Dictionary<int, BattleField>(); |
| | | public StoryBattleField storyBattleField = new StoryBattleField();//主线战场 |
| | | |
| | | protected Dictionary<int, BattleField> battleFields = new Dictionary<int, BattleField>(); |
| | | |
| | | public override void Init() |
| | | { |
| | | base.Init(); |
| | | EventBroadcast.Instance.AddListener<int, int>(EventName.BATTLE_ACTION_OVER, OnActionOver); |
| | | } |
| | | |
| | | public override void Release() |
| | |
| | | base.Release(); |
| | | } |
| | | |
| | | private void OnActionOver(int battleFieldId, int attackId) |
| | | public void StartStoryBattle() |
| | | { |
| | | BattleField battleField = null; |
| | | if (battleFields.TryGetValue(battleFieldId, out battleField)) |
| | | if (null == storyBattleField) |
| | | { |
| | | battleField.OnActionOver(attackId); |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("BattleManager OnActionOver battleFieldId:" + battleFieldId + " not find"); |
| | | storyBattleField = new StoryBattleField(); |
| | | |
| | | } |
| | | } |
| | | |
| | | public void Run() |
| | | { |
| | | if (null != storyBattleField) |
| | | { |
| | | storyBattleField.Run(); |
| | | } |
| | | |
| | | foreach (var battleField in battleFields) |
| | | { |
| | | battleField.Value.Run(); |
| | | battleField.Value?.Run(); |
| | | } |
| | | } |
| | | |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | |
| | | private Dictionary<int, BattleObject> redCampDict = new Dictionary<int, BattleObject>(); |
| | | private Dictionary<int, BattleObject> blueCampDict = new Dictionary<int, BattleObject>(); |
| | | |
| | | public void Init(int _levelId, TeamBase _redTeam, TeamBase _blueTeam = null) |
| | | public void Init(TeamBase _redTeam, TeamBase _blueTeam) |
| | | { |
| | | if (_levelId == 0 && _blueTeam == null) |
| | | { |
| | | Debug.LogError("BattleObjMgr Init Error: _levelId == 0 && _blueTeam == null 关卡id没有(不是PVE) 也没有蓝色队伍信息(也不是PVP))"); |
| | | return; |
| | | } |
| | | |
| | | if (_levelId != 0 && _blueTeam != null) |
| | | { |
| | | Debug.LogError("BattleObjMgr Init Error: _levelId!= 0 && _blueTeam != null 关卡id有(是PVE) 也有蓝色队伍信息(也不是PVP))"); |
| | | return; |
| | | } |
| | | |
| | | if (_levelId != 0) |
| | | { |
| | | _blueTeam = new TeamBase(); |
| | | _blueTeam.InitByLevelId(_levelId); |
| | | } |
| | | |
| | | CreateTeam(redCampDict, _redTeam); |
| | | CreateTeam(blueCampDict, _blueTeam); |
| | | } |
| | |
| | | item.Value.Run(); |
| | | } |
| | | } |
| | | |
| | | public void ResumeGame() |
| | | { |
| | | foreach (var item in redCampList) |
| | | { |
| | | item.ResumeGame(); |
| | | } |
| | | |
| | | foreach (var item in blueCampList) |
| | | { |
| | | item.ResumeGame(); |
| | | } |
| | | } |
| | | |
| | | public void PauseGame() |
| | | { |
| | | foreach (var item in redCampList) |
| | | { |
| | | item.PauseGame(); |
| | | } |
| | | |
| | | foreach (var item in blueCampList) |
| | | { |
| | | item.PauseGame(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | motionBase.Run(); |
| | | } |
| | | |
| | | |
| | | public virtual void PauseGame() |
| | | { |
| | | |
| | | } |
| | | |
| | | public virtual void ResumeGame() |
| | | { |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public void StartGame() |
| | | { |
| | | |
| | | } |
| | | |
| | | public void PlayNext() |
| | | { |
| | | |
| | | } |
| | | |
| | | public void Run() |
| | | public virtual void Run() |
| | | { |
| | | if (recordActionQueue.Count == 0) |
| | | { |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class ItemCost |
| | | { |
| | | public int itemId; |
| | | public int costNum; |
| | | |
| | | public ItemCost(int _itemId, int _costNum) |
| | | { |
| | | itemId = _itemId; |
| | | costNum = _costNum; |
| | | } |
| | | |
| | | public static List<ItemCost> GetList(int[] array) |
| | | { |
| | | List<ItemCost> retList = new List<ItemCost>(); |
| | | |
| | | if (array.Length % 2 != 0) |
| | | { |
| | | Debug.LogError("ItemCost.GetList Failure, because array % 2 != 0"); |
| | | return retList; |
| | | } |
| | | |
| | | for (int i = 0; i < array.Length; i += 2) |
| | | { |
| | | retList.Add(new ItemCost(array[i], array[i+1])); |
| | | } |
| | | |
| | | return retList; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 99306ce8f2356fd488b06f7de7d2557c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | |
| | | public enum HeroAttrType |
| | | { |
| | | // 生命 |
| | | hp, |
| | | // 攻击力 |
| | | attack, |
| | | // 防御力 |
| | | defense, |
| | | //眩晕概率 |
| | | stunRate, |
| | | //暴击概率 |
| | | critRate, |
| | | //连击概率 |
| | | comboRate, |
| | | //格挡概率 |
| | | blockRate, |
| | | //反击概率 |
| | | counterAttackRate, |
| | | //攻击目标时,造成伤害转化成生命的百分比数值提升 |
| | | recoverRate, |
| | | |
| | | //战斗抵抗属性 |
| | | //眩晕抵抗 |
| | | stunResist, |
| | | //暴击抵抗 |
| | | critResist, |
| | | //连击抵抗 |
| | | comboResist, |
| | | //格挡抵抗 |
| | | blockResist, |
| | | //反击抵抗 |
| | | counterAttackResist, |
| | | //减少攻击时吸血转化成生命的百分比数值 |
| | | recoverResist, |
| | | |
| | | // 特殊属性(待补充) |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0c340f5ce4b296047a302ba21f2a65d2 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | public class HeroFetterInfo |
| | | { |
| | | private HeroInfo heroInfo; |
| | | private int fetterId; |
| | | |
| | | public HeroFetterConfig fetterConfig; |
| | | |
| | | protected bool isActive = false; |
| | | |
| | | public HeroFetterInfo(HeroInfo _heroInfo, int _fetterId) |
| | | { |
| | | heroInfo = _heroInfo; |
| | | fetterId = _fetterId; |
| | | |
| | | fetterConfig = HeroFetterConfig.Get(fetterId); |
| | | } |
| | | |
| | | // 是否激活了羁绊 |
| | | public bool IsActiveFetter() |
| | | { |
| | | return isActive; |
| | | } |
| | | |
| | | public void SetIsActiveFetter(TeamBase teamBase) |
| | | { |
| | | int fetterHeroCount = fetterConfig.HeroIDList.Length; |
| | | |
| | | int count = 0; |
| | | |
| | | for (int i = 0; i < teamBase.teamHeros.Length; i++) |
| | | { |
| | | TeamHero teamHero = teamBase.teamHeros[i]; |
| | | |
| | | if (null == teamHero) |
| | | continue; |
| | | |
| | | if (Array.IndexOf(fetterConfig.HeroIDList, teamHero.heroInfo.heroId) >= 0) |
| | | { |
| | | count++; |
| | | } |
| | | } |
| | | |
| | | isActive = (count >= fetterHeroCount); |
| | | } |
| | | |
| | | public int GetFetterAttr(HeroAttrType attrType) |
| | | { |
| | | if (!isActive) |
| | | return 0; |
| | | |
| | | return fetterConfig.GetFetterAttr(attrType); |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 61d40aba9c2091445ae692419d4c5ebf |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | |
| | | protected int GetIFByInheritAwakePercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 7fba5bbc8a4d5c94e8691c63207e4edb |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | protected int GetBreakCultivationPercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | |
| | | protected int GetIFByInheritBreakPercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6c7d00805f733194e9f54b2c3c0ecc72 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | protected int GetCollectionCultivationPercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 14fc4e08ba34d504a936ff5d6c2b7c53 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | protected int GetEquipStableProperties(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 27a10dfeaeacac3439ab8ecc85001796 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | protected int GetIFByInheritFetterPercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | int total = 0; |
| | | for (int i = 0; i < fetterInfoList.Count; i++) |
| | | { |
| | | HeroFetterInfo fetterInfo = fetterInfoList[i]; |
| | | total += fetterInfo.GetFetterAttr(attrType); |
| | | } |
| | | return total; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 54b6d26a54e84c0489aed5a95980ad78 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | protected int GetLevelCultivationPercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2a7ad855fa3dd5249a06835e88181ddd |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public int attack = 0; |
| | | // 防御力 |
| | | public int defense = 0; |
| | | // 速度 |
| | | public int speed = 0; |
| | | |
| | | |
| | | |
| | | //战斗属性 |
| | | //闪避概率 |
| | | public float dodge = 0f; |
| | | //暴击概率 |
| | | public float crit = 0f; |
| | | //连击概率 |
| | | public float comboRate = 0f; |
| | | //战斗属性 击晕、暴击、连击、格挡、反击、吸血 |
| | | //眩晕概率 |
| | | public float stunRate = 0f; |
| | | public int stunRate = 0; |
| | | //暴击概率 |
| | | public int critRate = 0; |
| | | //连击概率 |
| | | public int comboRate = 0; |
| | | //格挡概率 |
| | | public int blockRate = 0; |
| | | //反击概率 |
| | | public float counterAttack = 0f; |
| | | public int counterAttackRate = 0; |
| | | //攻击目标时,造成伤害转化成生命的百分比数值提升 |
| | | public float recoverRate = 0f; |
| | | public int recoverRate = 0; |
| | | |
| | | //战斗抵抗属性 |
| | | //闪避抵抗 |
| | | public float dodgeResist = 0f; |
| | | //暴击抵抗 |
| | | public float critResist = 0f; |
| | | //连击抵抗 |
| | | public float comboResist = 0f; |
| | | //眩晕抵抗 |
| | | public float stunResist = 0f; |
| | | public int stunResist = 0; |
| | | //暴击抵抗 |
| | | public int critResist = 0; |
| | | //连击抵抗 |
| | | public int comboResist = 0; |
| | | //格挡抵抗 |
| | | public int blockResist = 0; |
| | | //反击抵抗 |
| | | public float counterAttackResist = 0f; |
| | | public int counterAttackResist = 0; |
| | | //减少攻击时吸血转化成生命的百分比数值 |
| | | public float recoverResist = 0f; |
| | | public int recoverResist = 0; |
| | | |
| | | // 特殊属性(待补充) |
| | | |
| | | |
| | | //计算个人/职业/种族养成属性加成 |
| | | public void CalculateProperties() |
| | | { |
| | | //todo |
| | | // 武将单体属性,根据继承比例,从全体属性继承得到 |
| | | // 例如:武将攻击力= |
| | | // [(装备基础固定值+其它模块的固定值)* (1+初始加成%+武将升级加成%+武将突破加成%+武将吞噬星级加成%+图鉴加成%)] |
| | | // * |
| | | // [ 继承比例*(1+羁绊加成%+潜能加成%+天赋加成%+觉醒效果加成%)] |
| | | hp = GetProperties(HeroAttrType.hp); |
| | | attack = GetProperties(HeroAttrType.attack); |
| | | defense = GetProperties(HeroAttrType.defense); |
| | | stunRate = GetProperties(HeroAttrType.stunRate); |
| | | critRate = GetProperties(HeroAttrType.critRate); |
| | | comboRate = GetProperties(HeroAttrType.comboRate); |
| | | blockRate = GetProperties(HeroAttrType.blockRate); |
| | | counterAttackRate = GetProperties(HeroAttrType.counterAttackRate); |
| | | recoverRate = GetProperties(HeroAttrType.recoverRate); |
| | | stunResist = GetProperties(HeroAttrType.stunResist); |
| | | critResist = GetProperties(HeroAttrType.critResist); |
| | | comboResist = GetProperties(HeroAttrType.comboResist); |
| | | blockResist = GetProperties(HeroAttrType.blockResist); |
| | | counterAttackResist = GetProperties(HeroAttrType.counterAttackResist); |
| | | recoverResist = GetProperties(HeroAttrType.recoverResist); |
| | | } |
| | | |
| | | protected int GetProperties(HeroAttrType attrType) |
| | | { |
| | | return GetStableProperties(attrType) |
| | | * GetCultivationPercent(attrType) |
| | | * GetInheritRate(attrType) |
| | | * GetInfluenceByInheritPercent(attrType); |
| | | } |
| | | |
| | | |
| | | // 固定值属性 |
| | | public int GetStableProperties(HeroAttrType attrType) |
| | | { |
| | | int stableValue = 0; |
| | | stableValue += GetEquipStableProperties(attrType); |
| | | return stableValue; |
| | | } |
| | | |
| | | // 培养百分比 |
| | | public int GetCultivationPercent(HeroAttrType attrType) |
| | | { |
| | | int cultivationPercent = 100; |
| | | cultivationPercent += GetQualityCultivationPercent(attrType);//初始加成根据武将品质决定,不同品质武将初始加成不同 HeroInfo.Quality.cs |
| | | cultivationPercent += GetLevelCultivationPercent(attrType);// 等级给的百分比 HeroInfo.Level.cs |
| | | cultivationPercent += GetBreakCultivationPercent(attrType);// 突破给的百分比 HeroInfo.Break.cs |
| | | cultivationPercent += GetStarCultivationPercent(attrType);// 吞噬星级给的百分比 HeroInfo.Star.cs |
| | | cultivationPercent += GetCollectionCultivationPercent(attrType);// 图鉴给的百分比 HeroInfo.Collection.cs |
| | | return cultivationPercent; |
| | | } |
| | | |
| | | // 被继承比例影响的百分比属性 |
| | | public int GetInfluenceByInheritPercent(HeroAttrType attrType) |
| | | { |
| | | // (1+羁绊加成%+潜能加成%+天赋加成%+觉醒效果加成%) |
| | | |
| | | int IFByInheritPercent = 100; |
| | | IFByInheritPercent += GetIFByInheritFetterPercent(attrType); //羁绊加成 HeroInfo.Fetter |
| | | IFByInheritPercent += GetIFByInheritBreakPercent(attrType); //潜能加成 HeroInfo.Break |
| | | IFByInheritPercent += GetIFByInheritTalentPercent(attrType); //天赋加成 HeroInfo.Talent |
| | | IFByInheritPercent += GetIFByInheritAwakePercent(attrType); //觉醒加成 HeroInfo.Awake |
| | | return IFByInheritPercent; |
| | | } |
| | | |
| | | public int CalculatePower() |
| | | { |
| | | //todo |
| | | return 0; |
| | | // 暂行 |
| | | return hp + |
| | | attack + |
| | | defense + |
| | | stunRate + |
| | | critRate + |
| | | comboRate + |
| | | blockRate + |
| | | counterAttackRate + |
| | | recoverRate + |
| | | stunResist + |
| | | critResist + |
| | | comboResist + |
| | | blockResist + |
| | | counterAttackResist + |
| | | recoverResist; |
| | | } |
| | | } |
New file |
| | |
| | | |
| | | |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | protected int GetQualityCultivationPercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 8540c5ed5104dfe40b0bff4aaf9a080b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | { |
| | | get |
| | | { |
| | | if (null == heroConfig) |
| | | return 0; |
| | | |
| | | if (SkinIndex > heroConfig.SkinNPCIDList.Length && SkinIndex >= 0) |
| | | { |
| | | return heroConfig.SkinNPCIDList[SkinIndex]; |
| | | } |
| | | return 0; |
| | | return heroConfig.SkinNPCIDList[0]; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | |
| | | |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | protected int GetStarCultivationPercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 01382d3bab4b6674ba541f0704dd7037 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | protected int GetIFByInheritTalentPercent(HeroAttrType attrType) |
| | | { |
| | | // YYL TODO |
| | | return 0; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6ca2b1a1de9030c4eaf3b2b272ec9aad |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public long sid; |
| | | |
| | | // 武将配置表ID |
| | | public int heroId; |
| | | public int heroId |
| | | { |
| | | get |
| | | { |
| | | return itemHero.config.ID; |
| | | } |
| | | } |
| | | |
| | | // 武将等级 |
| | | public int heroLevel; |
| | |
| | | |
| | | // 武将突破等级 |
| | | public int breakLevel; |
| | | |
| | | // 武将觉醒等级 |
| | | public int awakeLevel; |
| | | |
| | | |
| | | public HeroCountry heroCountry |
| | |
| | | } |
| | | } |
| | | |
| | | public readonly ItemModel itemHero; |
| | | |
| | | #region 配置 |
| | | 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 HeroTalentConfig talentConfig; |
| | | #endregion 配置 |
| | | public List<HeroFetterInfo> fetterInfoList = new List<HeroFetterInfo>(); |
| | | public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>(); |
| | | |
| | | |
| | | public HeroSkillMgr heroSkillMgr; |
| | | |
| | | public HeroInfo(CB122_tagSCHeroInfo.tagSCHero scHeroInfo, ItemModel itemHero) |
| | | public HeroInfo(CB122_tagSCHeroInfo.tagSCHero _scHeroInfo, ItemModel _itemHero) |
| | | { |
| | | heroSkillMgr = new HeroSkillMgr(this); |
| | | scHeroInfo = _scHeroInfo; |
| | | itemHero = _itemHero; |
| | | |
| | | InitConfigs(); |
| | | // HeroConfigUtility |
| | | // 71 # 英雄天赋ID列表 |
| | | // 73 # 英雄天赋ID等级列表,对应71天赋ID的等级 |
| | | // 75 # 英雄天赋洗炼锁定索引列表,对应71天赋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); |
| | | |
| | | 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列表 |
| | | // 70 # 英雄等级 |
| | | // 72 # 英雄星级 |
| | | // 74 # 英雄突破等级 |
| | | // 76 # 英雄觉醒等级 |
| | | // 78 # 英雄使用的皮肤索引 |
| | | // 80 # 主阵型上阵位置 |
| | | |
| | | #region 皮肤 |
| | | // skinConfig |
| | | #endregion 皮肤 |
| | | |
| | | |
| | | #region 天赋 |
| | | |
| | | #endregion 天赋 |
| | | |
| | | } |
| | | |
| | | 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); |
| | | |
| | | // 品质突破配置 |
| | | qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel); |
| | | |
| | | } |
| | | |
| | | public int GetInheritRate(HeroAttrType attrType) |
| | | { |
| | | return heroConfig.GetInheritPercent(attrType); |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | public void UpdateHeroInfo() |
| | | { |
| | | |
| | | } |
| | | |
| | | public List<HeroInfo> GetPowerfulHeroList() |
| | | { |
| | | List<HeroInfo> heroList = new List<HeroInfo>(heroInfoDict.Values); |
| | | |
| | | heroList.Sort((a, b) => |
| | | { |
| | | int power1 = a.CalculatePower(); |
| | | int power2 = b.CalculatePower(); |
| | | |
| | | if (power1 == power2) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | return power1 > power2 ? -1 : 1; |
| | | }); |
| | | |
| | | List<HeroInfo> retList = new List<HeroInfo>(); |
| | | |
| | | for (int i = 0; i < TeamConst.MaxTeamHeroCount && i < heroList.Count; i++) |
| | | { |
| | | retList.Add(heroList[i]); |
| | | } |
| | | |
| | | return retList; |
| | | } |
| | | |
| | | // public override bool IsNessaryDataReady() |
| | | // { |
| | | // return true; |
New file |
| | |
| | | |
| | | |
| | | public class HeroTalentInfo |
| | | { |
| | | public HeroTalentConfig config; |
| | | |
| | | public HeroInfo heroInfo; |
| | | |
| | | public int talentId; |
| | | |
| | | public int talentLv; |
| | | |
| | | public int lockIndex; |
| | | |
| | | public HeroTalentInfo(HeroInfo _heroInfo, int _talentId, int _talentLv, int _lockIndex) |
| | | { |
| | | heroInfo = _heroInfo; |
| | | talentId = _talentId; |
| | | talentLv = _talentLv; |
| | | lockIndex = _lockIndex; |
| | | |
| | | config = HeroTalentConfig.Get(talentId); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 262ca07cf60e33946bf5fc0a9a1007ab |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | |
| | | // 阵型内卡牌的羁绊增益 |
| | | |
| | | public void CalculateProperties(HeroInfo heroInfo) |
| | | { |
| | | protected void UpdateProperties() |
| | | { |
| | | // 羁绊 |
| | | for (int i = 0; i < teamHeros.Length; i++) |
| | | { |
| | | TeamHero hero = teamHeros[i]; |
| | | if (null != hero) |
| | | { |
| | | for (int j = 0; j < hero.heroInfo.fetterInfoList.Count; j++) |
| | | { |
| | | hero.heroInfo.fetterInfoList[j].SetIsActiveFetter(this); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | // 阵型 |
| | | |
| | | |
| | | // 属性计算 |
| | | for (int i = 0; i < teamHeros.Length; i++) |
| | | { |
| | | TeamHero hero = teamHeros[i]; |
| | | if (null != hero) |
| | | hero.heroInfo.CalculateProperties(); |
| | | } |
| | | } |
| | | |
| | | public void CalculatePower() |
| | | { |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | // 阵型基础 |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | public void AddTeamHeros(List<HeroInfo> heroInfos) |
| | | { |
| | | for (int i = 0; i < heroInfos.Count; i++) |
| | | { |
| | | AddTeamHero(heroInfos[i]); |
| | | } |
| | | |
| | | UpdateProperties(); |
| | | } |
| | | |
| | | public bool AddTeamHero(HeroInfo heroInfo) |
| | | { |
| | | if (heroInfo == null) |
| | |
| | | teamHeros[i] = new TeamHero(); |
| | | teamHeros[i].heroInfo = heroInfo; |
| | | teamHeros[i].heroIndex = i; |
| | | UpdateProperties(); |
| | | return true; |
| | | } |
| | | } |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | |
| | | |
| | | public class TeamManager : GameSystemManager<TeamManager> |
| | | { |
| | | protected Dictionary<TeamType, TeamBase> teamDict = new Dictionary<TeamType, TeamBase>(); |
| | | |
| | | public override void Init() |
| | | { |
| | | base.Init(); |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | base.Release(); |
| | | } |
| | | |
| | | public TeamBase GetTeam(TeamType teamType) |
| | | { |
| | | TeamBase team = null; |
| | | |
| | | if (!teamDict.TryGetValue(teamType, out team)) |
| | | { |
| | | team = GetStoryTeam(); |
| | | teamDict.Add(teamType, team); |
| | | } |
| | | |
| | | return team; |
| | | } |
| | | |
| | | public TeamBase GetStoryTeam() |
| | | { |
| | | TeamBase team = null; |
| | | |
| | | if (!teamDict.TryGetValue(TeamType.Story, out team)) |
| | | { |
| | | team = new TeamBase(); |
| | | team.AddTeamHeros(HeroManager.Instance.GetPowerfulHeroList()); |
| | | teamDict.Add(TeamType.Story, team); |
| | | } |
| | | |
| | | return team; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: b9e93ce1fa26cdf4fafced36fb2bd0de |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | |
| | | |
| | | public enum TeamType |
| | | { |
| | | None = 0, |
| | | // PVE |
| | | Story = 1, |
| | | |
| | | |
| | | // PVP |
| | | Arena = 101, |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 097080eb83a42b54bbc2b10bc100993b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |