From 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 05 十一月 2025 17:40:23 +0800
Subject: [PATCH] 130 战斗修改回合样式
---
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs | 130 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 124 insertions(+), 6 deletions(-)
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index d02c2b9..364f3fe 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -1,4 +1,3 @@
-
using System.Collections.Generic;
using UnityEngine;
@@ -50,7 +49,8 @@
public void PrintAllPack()
{
- string temp = "CustomHB426CombinePack startTag: " + (startTag != null ? startTag.Tag : "null") + " fromIndex: " + fromIndex + " toIndex: " + toIndex + "\n";
+ string temp = "CustomHB426CombinePack startTag: " + (startTag != null ? startTag.Tag : "null") +
+ " fromIndex: " + fromIndex + " toIndex: " + toIndex + " packList.Count: " + packList.Count + "\n";
for (int i = 0; i < packList.Count; i++)
{
var pack = packList[i];
@@ -63,7 +63,7 @@
temp += " pack type is " + pack.GetType().Name + "\n";
}
}
- // BattleDebug.LogError(temp);
+ BattleDebug.LogError(temp);
}
public void AddPack(GameNetPackBasic pack)
@@ -98,6 +98,8 @@
Dictionary<string, CustomHB426CombinePack> combineDict = new Dictionary<string, CustomHB426CombinePack>();
Dictionary<int, GameNetPackBasic> indexDict = new Dictionary<int, GameNetPackBasic>();
+
+ Dictionary<uint, HB427_tagSCUseSkill> skillDict = new Dictionary<uint, HB427_tagSCUseSkill>();
for (int i = 0; i < b421SeriesPackList.Count; i++)
{
@@ -134,7 +136,39 @@
}
else
{
- indexDict.Add(i, pack);
+ if (pack is HB427_tagSCUseSkill skillPack)
+ {
+ // 澶勭悊鎶�鑳戒箣闂寸殑閾炬帴鍏崇郴
+ if (skillPack.RelatedSkillID > 0)
+ {
+ skillDict.TryGetValue(skillPack.RelatedSkillID, out var parentSkill);
+
+ if (parentSkill != null && skillPack.BattleType == 4)//4=瀛愭妧鑳�
+ {
+ parentSkill.subSkillList.Add(skillPack);
+ skillPack.parentSkill = parentSkill;
+ }
+ indexDict.Add(i, pack);
+
+ }
+ else
+ {
+ indexDict.Add(i, pack);
+ }
+
+ if (skillDict.ContainsKey(skillPack.SkillID))
+ {
+ skillDict[skillPack.SkillID] = skillPack;
+ }
+ else
+ {
+ skillDict.Add(skillPack.SkillID, skillPack);
+ }
+ }
+ else
+ {
+ indexDict.Add(i, pack);
+ }
}
}
@@ -200,6 +234,57 @@
{
battleField.PlayRecord(skillAction);
}
+ else
+ {
+ battleField.DistributeNextPackage();
+ }
+
+ }
+
+ public static SkillRecordAction CreateSkillAction(string guid, List<GameNetPackBasic> _packList)
+ {
+ BattleField battleField = BattleManager.Instance.GetBattleField(guid);
+
+ if (null == battleField)
+ {
+ Debug.LogError("BattleField not found for guid: " + guid);
+ return null;
+ }
+
+ while (_packList.Count > 0)
+ {
+ var pack = _packList[0];
+ _packList.RemoveAt(0);
+
+ if (pack is HB427_tagSCUseSkill)
+ {
+ _packList.Insert(0, pack);
+ break;
+ }
+ else if (pack is CustomHB426CombinePack)
+ {
+ Debug.LogError("鏃犳硶鎵惧埌Skill鍖咃紝鍏堝彂鐜颁簡宓屽鍖�");
+ return null;
+ }
+ else
+ {
+ // Debug.LogError("鍙戠幇闈濻kill鍖咃紝鍏堝垎鍙戞帀: " + pack.GetType().Name);
+ PackageRegedit.Distribute(pack);
+ }
+ }
+
+ HB427_tagSCUseSkill skill = _packList[0] as HB427_tagSCUseSkill;
+ _packList.RemoveAt(0);
+ if (null == skill)
+ {
+ Debug.LogError("No HB427_tagSCUseSkill found in packList.");
+ return null;
+ }
+
+ BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
+
+ SkillRecordAction skillAction = new SkillRecordAction(battleField, _caster, skill, _packList);
+ return skillAction;
}
@@ -213,12 +298,45 @@
return null;
}
+ // 鏈嶅姟鍣ㄤ慨鏀逛簡 鐜板湪绗竴涓笉涓�瀹氭槸B427 涔熸湁鍙兘鏄疊428 鍏堟斁Buff
+ while (packList.Count > 0)
+ {
+ var pack = packList[0];
+ packList.RemoveAt(0);
+
+ if (pack is HB427_tagSCUseSkill)
+ {
+ packList.Insert(0, pack);
+ break;
+ }
+ else if (pack is CustomHB426CombinePack)
+ {
+ Debug.LogError("鏃犳硶鎵惧埌Skill鍖咃紝鍏堝彂鐜颁簡宓屽鍖�");
+ return null;
+ }
+ else
+ {
+ // Debug.LogError("鍙戠幇闈濻kill鍖咃紝鍏堝垎鍙戞帀: " + pack.GetType().Name);
+ PackageRegedit.Distribute(pack);
+ }
+ }
+
if (startTag.Tag.StartsWith("Skill_"))
{
+ if (packList.Count <= 0)
+ {
+ Debug.LogError("No HB427_tagSCUseSkill found in packList." + startTag.Tag);
+ return null;
+ }
HB427_tagSCUseSkill skill = packList[0] as HB427_tagSCUseSkill;
- packList.Remove(skill);
- BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
+ packList.RemoveAt(0);
+ if (null == skill)
+ {
+ Debug.LogError("No HB427_tagSCUseSkill found in packList.");
+ return null;
+ }
+ BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
// BattleDebug.LogError("_caster == null : " + (_caster == null) + " skill.ObjID : " + skill.ObjID);
SkillRecordAction skillAction = new SkillRecordAction(battleField, _caster, skill, packList);
--
Gitblit v1.8.0