| | |
| | | private Dictionary<int, BattleDrops> tempDropList = new Dictionary<int, BattleDrops>(); |
| | | private Dictionary<int, HB422_tagMCTurnFightObjDead> tempDeadPackList = new Dictionary<int, HB422_tagMCTurnFightObjDead>(); |
| | | |
| | | protected List<HB428_tagSCBuffRefresh> buffCollections = new List<HB428_tagSCBuffRefresh>(); |
| | | |
| | | |
| | | // 构造函数:初始化技能基础数据 |
| | | public SkillBase(BattleObject _caster, SkillConfig _skillCfg, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null) |
| | | { |
| | |
| | | } |
| | | |
| | | // 处理剩余包 |
| | | while (packList.Count > 0) |
| | | if (!ResolvePackList()) |
| | | { |
| | | var pack = packList[0]; |
| | | packList.RemoveAt(0); |
| | | |
| | | if (pack is CustomHB426CombinePack combinePack && combinePack.startTag.Tag.StartsWith("Skill_")) |
| | | { |
| | | BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag); |
| | | var otherSkillAction = combinePack.CreateSkillAction(); |
| | | otherSkillAction.fromSkillId = skillConfig.SkillID; |
| | | otherSkillActionList.Add(otherSkillAction); |
| | | return; |
| | | } |
| | | |
| | | if (pack is CustomB421ActionPack actionPack) |
| | | { |
| | | actionPack.Distribute(); |
| | | } |
| | | else |
| | | { |
| | | PackageRegedit.Distribute(pack); |
| | | } |
| | | } |
| | | // } |
| | | // catch (Exception ex) |
| | |
| | | isFinished = true; |
| | | } |
| | | |
| | | protected virtual bool ResolvePackList() |
| | | { |
| | | while (packList.Count > 0) |
| | | { |
| | | var pack = packList[0]; |
| | | packList.RemoveAt(0); |
| | | |
| | | if (pack is CustomHB426CombinePack combinePack && combinePack.startTag.Tag.StartsWith("Skill_")) |
| | | { |
| | | BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag); |
| | | var otherSkillAction = combinePack.CreateSkillAction(); |
| | | otherSkillAction.fromSkillId = skillConfig.SkillID; |
| | | otherSkillActionList.Add(otherSkillAction); |
| | | return false; |
| | | } |
| | | else if (pack is HB428_tagSCBuffRefresh buffRefresh) |
| | | { |
| | | // 从找到第一个HB428开始 找出连续的HB428_tagSCBuffRefresh包 如果找到一个B428后 之后碰到非HB428包就停止 |
| | | buffCollections.Add(buffRefresh); |
| | | while (packList.Count > 0) |
| | | { |
| | | var nextPack = packList[0]; |
| | | if (nextPack is HB428_tagSCBuffRefresh nextBuffRefresh) |
| | | { |
| | | buffCollections.Add(nextBuffRefresh); |
| | | packList.RemoveAt(0); |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // 同时刷新所有对象的buff,不分组 |
| | | foreach (var buff in buffCollections) |
| | | { |
| | | BattleObject battleObj = battleField.battleObjMgr.GetBattleObject((int)buff.ObjID); |
| | | if (battleObj != null) |
| | | { |
| | | battleObj.buffMgr.RefreshBuff(buff, true); |
| | | } |
| | | } |
| | | |
| | | // 清空已处理的buff集合 |
| | | buffCollections.Clear(); |
| | | continue; |
| | | } |
| | | |
| | | if (pack is CustomB421ActionPack actionPack) |
| | | { |
| | | actionPack.Distribute(); |
| | | } |
| | | else |
| | | { |
| | | PackageRegedit.Distribute(pack); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | // 添加清理方法:防止内存泄漏 |
| | | public virtual void Cleanup() |
| | | { |