From 6bc8a17ed56027c54cdd523dda04a049f5e2e8dd Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 21 一月 2026 10:40:54 +0800
Subject: [PATCH] 125 战斗 修复战斗卡死问题 并移除了子技能的设计 只有内嵌技能
---
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs | 425 ++++++++++--------------
Main/System/Battle/BattleManager.cs | 12
Main/System/Battle/BattleUtility.cs | 4
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB422_tagMCTurnFightObjDead.cs | 6
Main/System/Battle/Skill/RebornSkill.cs | 45 +
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs | 154 ++------
Main/System/Battle/BattleField/BattleField.cs | 16
/dev/null | 11
Main/System/Battle/RecordPlayer/RecordAction.cs | 35 ++
Main/System/Battle/RecordPlayer/RecordPlayer.cs | 28 +
Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs | 67 +++
Main/System/Battle/BattleTweenMgr.cs | 4
Main/System/Battle/BattleObject/BattleObject.cs | 24 -
Main/Core/NetworkPackage/CustomServerPack/CustomHB427_tagSCUseSkill.cs | 33 -
Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs | 101 ++++-
Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs | 36 ++
16 files changed, 499 insertions(+), 502 deletions(-)
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs
deleted file mode 100644
index fb2be7c..0000000
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-
-using System.Collections.Generic;
-using UnityEngine;
-
-public class CustomB421ActionPack : GameNetPackBasic
-{
- public int actionPackId = 0;
-
- private static int autoincreaseId = 10000;
-
- public CustomB421ActionPack()
- {
- actionPackId = autoincreaseId++;
- }
- public string guid;
-
- public Queue<GameNetPackBasic> actionPacks = new Queue<GameNetPackBasic>();
-
- public static CustomB421ActionPack CreateB421ActionPack(string _guid, List<GameNetPackBasic> packList)
- {
- CustomB421ActionPack actionPack = new CustomB421ActionPack();
-
- // 鍚堝苟涓�涓嬭繖涓鑹茬殑琛屽姩鍐呭鐨勬妧鑳� 鍒朵綔鎴怌ustomB421ActionPack
- List<GameNetPackBasic> combinedPackList = CustomHB426CombinePack.CombineToSkillPackFromList(_guid, packList);
- actionPack.guid = _guid;
- actionPack.actionPacks = new Queue<GameNetPackBasic>(combinedPackList);
- return actionPack;
- }
-
- public void Distribute()
- {
- while (actionPacks.Count > 0)
- {
- GameNetPackBasic pack = actionPacks.Dequeue();
-
- if (pack is CustomHB426CombinePack b426Pack)
- {
- b426Pack.Distribute();
- }
- else
- {
- PackageRegedit.Distribute(pack);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs.meta b/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs.meta
deleted file mode 100644
index 986cbc4..0000000
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 436c83b5afc693841b2b3f51ec07d020
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index 2d0f79b..61e77e9 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@@ -100,8 +101,6 @@
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++)
{
var pack = b421SeriesPackList[i];
@@ -137,42 +136,7 @@
}
else
{
- if (pack is HB427_tagSCUseSkill skillPack)
- {
- // 澶勭悊鎶�鑳戒箣闂寸殑閾炬帴鍏崇郴
- if (skillPack.RelatedSkillID > 0)
- {
- // 濡傛灉鏄 HB426_tagSCTurnFightTag 鍖呰9鐨勭涓�涓妧鑳藉寘 骞朵笖鍓嶉潰娌℃湁CustomHB426CombinePack
- // 鍒欓渶瑕佹妸CustomHB426CombinePack鍔犲叆skillPack鐨剆ubSkillCombinePackList閲�
- // 鍚屾椂 闇�瑕佹妸indexDict閲屽垹鎺夊搴旂殑subSkillCombinePackList
- // subSkillList鍒犳帀瀵瑰簲skillPack锛屼絾鏄痵killPack鐨刾arentSkill涓嶅彉
-
- 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);
- }
+ indexDict.Add(i, pack);
}
}
@@ -195,70 +159,6 @@
// 濡傛灉鏄祵濂楃殑鍖� 鍔犲叆涔嬪悗 璋冩暣i
i = cbPack.toIndex;
}
- }
- }
- }
-
-
- for (int i = 0; i < b421SeriesPackList.Count; i++)
- {
- if (indexDict.TryGetValue(i, out var pack))
- {
- if (pack is CustomHB426CombinePack cbPack)
- {
- HB427_tagSCUseSkill skillPack = cbPack.GetMainHB427SkillPack();
-
- if (null == skillPack)
- {
- continue;
- }
-
- // 濡傛灉鏄瓙鎶�鑳�
- if (skillPack.isSubSkill)
- {
- // 璁╁埆浜烘潵澶勭悊
- continue;
- }
- else
- {
- // 澶勭悊瀛愭妧鑳�
- if (skillPack.subSkillList.Count > 0)
- {
- var parentSkill = skillPack;
- List<HB427_tagSCUseSkill> toRemoveSubSkills = new List<HB427_tagSCUseSkill>();
- foreach (var subSkill in parentSkill.subSkillList)
- {
- CustomHB426CombinePack innerCBPack = null;
- if (cbPack.IsInnerCBPackContainsSkill(subSkill, ref innerCBPack))
- {
- if (cbPack.GetMainHB427SkillPack() == subSkill)
- {
- parentSkill.subSkillList.Remove(subSkill);
- Debug.LogError("瀛愭妧鑳戒笉鑳芥槸涓绘妧鑳�: " + subSkill.SkillID);
- continue;
- }
- subSkill.parentCombinePack = innerCBPack;
- cbPack.packList.Remove(innerCBPack);
- toRemoveSubSkills.Add(subSkill);
- parentSkill.subSkillCombinePackList.Add(innerCBPack);
- indexDict.Remove(innerCBPack.fromIndex);
- }
- }
- foreach (var subSkill in toRemoveSubSkills)
- {
- parentSkill.subSkillList.Remove(subSkill);
- }
- }
- else
- {
- // 涓绘妧鑳芥病鏈夊瓙鎶�鑳� 鐩存帴璺宠繃
- continue;
- }
- }
- }
- else if (pack is HB427_tagSCUseSkill skillPack)
- {
- // Debug.LogError("钀藉崟鐨勬妧鑳�");
}
}
}
@@ -316,7 +216,7 @@
}
return false;
}
- public void Distribute()
+ public void Distribute(RecordAction parentAction = null)
{
BattleField battleField = BattleManager.Instance.GetBattleField(guid);
@@ -329,7 +229,14 @@
var skillAction = CreateSkillAction();
if (null != skillAction)
{
- battleField.PlayRecord(skillAction);
+ if (parentAction != null)
+ {
+ parentAction.GetInnerRecordPlayer().PlayRecord(skillAction);
+ }
+ else
+ {
+ battleField.PlayRecord(skillAction);
+ }
}
else
{
@@ -434,6 +341,8 @@
return null;
}
HB427_tagSCUseSkill skill = packList[0] as HB427_tagSCUseSkill;
+
+
packList.RemoveAt(0);
if (null == skill)
{
@@ -467,5 +376,42 @@
return pack;
}
+
+ public bool NeedWaiting()
+ {
+ bool needWaiting = false;
+
+ HB427_tagSCUseSkill hB427_TagSCUseSkill = GetMainHB427SkillPack();
+
+ for (int i = 0; i < packList.Count; i++)
+ {
+ var pack = packList[i];
+ if (pack is HB427_tagSCUseSkill skillPack && skillPack != hB427_TagSCUseSkill)
+ {
+ SkillConfig ssc = SkillConfig.Get((int)skillPack.SkillID);
+ if (!string.IsNullOrEmpty(ssc.SkillMotionName))
+ {
+ needWaiting = true;
+ break;
+ }
+ }
+ else if (pack is HB422_tagMCTurnFightObjDead dead)
+ {
+ needWaiting = true;
+ break;
+ }
+ else if (pack is CustomHB426CombinePack combinePack)
+ {
+ if (combinePack.NeedWaiting())
+ {
+ needWaiting = true;
+ break;
+ }
+ }
+ }
+
+
+ return needWaiting;
+ }
#endif
}
\ No newline at end of file
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB427_tagSCUseSkill.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB427_tagSCUseSkill.cs
index 51300ec..098d631 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB427_tagSCUseSkill.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB427_tagSCUseSkill.cs
@@ -9,39 +9,6 @@
// 瑁搁湶鍦ㄥ鐨勬妧鑳戒笉鑰冭檻瀛愭妧鑳� 璺� parentSkill ( CustomHB426CombinePack )
//-------------------------------------------//
-
- public HashSet<HB427_tagSCUseSkill> subSkillList
- {
- get;
- set;
- } = new HashSet<HB427_tagSCUseSkill>();
-
- public HashSet<CustomHB426CombinePack> subSkillCombinePackList
- {
- get;
- set;
- } = new HashSet<CustomHB426CombinePack>();
-
- public HB427_tagSCUseSkill parentSkill
- {
- get;
- set;
- } = null;
-
- public CustomHB426CombinePack parentCombinePack
- {
- get;
- set;
- } = null;
-
- public bool isSubSkill
- {
- get
- {
- return parentSkill != null;
- }
- }
-
public partial class tagSCUseSkillHurt {
public bool isChangedRawAttackType = false;
}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB422_tagMCTurnFightObjDead.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB422_tagMCTurnFightObjDead.cs
index 60d3216..84fcca2 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB422_tagMCTurnFightObjDead.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB422_tagMCTurnFightObjDead.cs
@@ -15,7 +15,11 @@
// 鐢辨妧鑳藉幓閫氱煡鎴樺満姝讳骸 battleField.OnObjsDead(deadList)
#if UNITY_EDITOR
BattleDebug.LogError("缂栬緫鍣ㄤ笅鐨勬浜℃祴璇�");
- battleField?.OnObjsDead(new List<BattleDeadPack>(){ new BattleDeadPack(){ deadPack = vNetData}});
+ RecordAction rc = battleField?.OnObjsDead(new List<BattleDeadPack>(){ new BattleDeadPack(){ deadPack = vNetData}});
+ if (null != rc)
+ {
+ battleField?.recordPlayer.ImmediatelyPlay(rc);
+ }
#endif
if (!vNetPack.commonMark)
battleField?.DistributeNextPackage();
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs
index 85d56c6..8cd8c7f 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs
@@ -4,189 +4,51 @@
using System.Text;
using System.Collections.Generic;
using System.Linq;
-// B4 30 鏌ョ湅鎴樻姤缁撴灉 #tagSCTurnFightReportRet
-
+/// <summary>
+/// B4 30 鎴樻姤缁撴灉澶勭悊绫�
+/// 璐熻矗瑙f瀽鏈嶅姟鍣ㄨ繑鍥炵殑鎴樻姤鏁版嵁鍖咃紝骞跺垎鍙戝埌鎴樺満绯荤粺
+/// </summary>
public class DTCB430_tagSCTurnFightReport : DtcBasic
{
+ private static byte[] vCmdBytes = new byte[2];
+ private bool canAddPack = false;
- static byte[] vCmdBytes = new byte[2];
- bool canAddPack = false;
-
+ /// <summary>
+ /// 鎴樻姤鏁版嵁鍖呭鐞嗕富鍏ュ彛
+/// 瑙f瀽鎴樻姤瀛楄妭娴侊紝鎻愬彇鎵�鏈夋垬鏂楀寘锛屽苟鎸夐『搴忓垎鍙戝埌鎴樺満
+ /// </summary>
public override void Done(GameNetPackBasic vNetPack)
{
base.Done(vNetPack);
HB430_tagSCTurnFightReport vNetData = vNetPack as HB430_tagSCTurnFightReport;
- // 鎴樻姤缁撴灉
string guid = UIHelper.ServerStringTrim(vNetData.GUID);
canAddPack = false;
Debug.Log("鎴樻枟鏃跺簭 B430 寮�濮嬪鐞嗘垬鏂� " + Time.time);
- //绾﹀畾 B430 鍐呭锛堝皬鍖�1闀垮害WORD + 鍖�1 + 灏忓寘2闀垮害WORD + 鍖�2锛�
- //绾﹀畾绗竴涓寘鏄疊424锛屽厛鍙戣繃鏉ョ殑杩囨护鎶ラ敊閫氱煡
+
try
{
- int vReadIndex = 0;
- byte[] vPackBytes;
- int vLeavingLeng = 0;
- int vBodyLeng = 0;
- int vTotalLeng = vNetData.reportBytes.Length;
-
- List<GameNetPackBasic> vPackList = new List<GameNetPackBasic>();
-
- while (vReadIndex < vTotalLeng)
- {
- vLeavingLeng = vTotalLeng - vReadIndex;
- if (vLeavingLeng < 4)
- {
- //鍖呭ご鑷冲皯闇�瑕�4瀛楄妭
- Debug.LogError("DTCB430_tagSCTurnFightReport: vLeavingLeng < 2 瑙e寘澶辫触");
- break;
- }
-
- //绾﹀畾灏忓皝鍖呯殑闀垮害
- vBodyLeng = BitConverter.ToInt16(vNetData.reportBytes, vReadIndex);
- if (vBodyLeng > vLeavingLeng)// 鏈畬鏁寸殑鍖� 鎶ラ敊
- {
- Debug.LogError("DTCB430_tagSCTurnFightReport: vBodyLeng > vLeavingLeng瑙e寘澶辫触");
- break;
- }
-
- vPackBytes = new byte[vBodyLeng];
- Array.Copy(vNetData.reportBytes, vReadIndex + 2, vPackBytes, 0, vBodyLeng);
-
- Array.Copy(vPackBytes, 0, vCmdBytes, 0, 2);
- var cmd = (ushort)((ushort)(vCmdBytes[0] << 8) + vCmdBytes[1]);
- bool isRegist = false; // 鏈敞鍐屽皝鍖呭鐞�
-
- if (PackageRegedit.Contain(cmd))
- {
- GameNetPackBasic npk = PackageRegedit.TransPack(ServerType.B430, cmd, vPackBytes);
- if (npk != null)
- {
- if (!FilterBeforeB424(npk))
- {
- npk.socketType = ServerType.B430;
- vPackList.Add(npk);
- BattleManager.Instance.PushPackUID(guid, npk.packUID);
- }
- isRegist = true;
- }
- }
-
- vReadIndex += 2 + vBodyLeng;
-
- // 鏈敞鍐屽皝鍖呭鐞�
- if (!isRegist)
- {
-#if UNITY_EDITOR
- PackageRegedit.TransPack(ServerType.B430, cmd, vPackBytes);
-#endif
- }
- }
-#if UNITY_EDITOR
- // 瑙f瀽鎵�鏈塿PackList閲岀殑姣忎釜瀛楁锛堟繁搴︼級骞朵笖杈撳嚭鍒癆pplication.dataPath + "/../BattleReport/PackageDetailAnalysis_鏃堕棿鎴�.txt鏂囦欢閲�
-
-
-
- string originPack = string.Empty;
- BattleField battleField = BattleManager.Instance.GetBattleField(guid);
-
- for (int i = 0; i < vPackList.Count; i++)
- {
- var pack = vPackList[i];
-
- if (pack is HB427_tagSCUseSkill skill)
- {
- string heroName = skill.ObjID.ToString();
- if (battleField != null)
- {
- var battleObj = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
- if (battleObj != null && battleObj.teamHero != null)
- {
- heroName = battleObj.teamHero.name;
- }
- }
-
- string skillName = SkillConfig.Get((int)skill.SkillID)?.SkillName ?? "Unknown";
- originPack += $"[{pack.packUID}] HB427_tagSCUseSkill - ObjID:{skill.ObjID} HeroName:{heroName} SkillID:{skill.SkillID} SkillName:{skillName}\n";
- }
- else if (pack is HB426_tagSCTurnFightTag tag)
- {
- string signText = tag.Sign == 0 ? "Start" : tag.Sign == 1 ? "End" : "Unknown";
- originPack += $"[{pack.packUID}] HB426_tagSCTurnFightTag - Tag:{tag.Tag} Sign:{tag.Sign}({signText})\n";
- }
- else if (pack is HB422_tagMCTurnFightObjDead deadPack)
- {
- string heroName = deadPack.ObjID.ToString();
- if (battleField != null)
- {
- var battleObj = battleField.battleObjMgr.GetBattleObject((int)deadPack.ObjID);
- if (battleObj != null && battleObj.teamHero != null)
- {
- heroName = battleObj.teamHero.name;
- }
- }
- originPack += $"[{pack.packUID}] HB422_tagMCTurnFightObjDead - ObjID:{deadPack.ObjID} HeroName:{heroName}\n";
- }
- else
- {
- originPack += $"[{pack.packUID}] {pack.GetType().Name}\n";
- }
- }
-#endif
+ // 1. 瑙f瀽鎴樻姤瀛楄妭娴侊紝鎻愬彇鎵�鏈夊寘
+ List<GameNetPackBasic> vPackList = ParseReportBytes(vNetData.reportBytes, guid);
#if UNITY_EDITOR
- DebugingBuffStatus(vPackList);
+ // 2. 淇濆瓨瑙f瀽鍓嶇殑鍖呰鎯咃紙璋冭瘯鐢級
+ SavePackageDetailBeforeAnalysis(vPackList, guid);
#endif
-
-#if UNITY_EDITOR
-#region Start Print Before Pack List Detail
- if (Launch.Instance.isOpenSkillLogFile)
- {
- try
- {
- string detailAnalysis = PrintPackageDetailAnalysis(vPackList, guid);
- string filePath = Application.dataPath + "/../BattleReport/PackageBeforeDetailAnalysis_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt";
- System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(filePath));
- System.IO.File.WriteAllText(filePath, detailAnalysis);
- Debug.Log("鍖呰缁嗗垎鏋愬凡淇濆瓨鍒�: " + filePath);
- }
- catch (Exception e)
- {
- Debug.LogError("淇濆瓨鍖呰缁嗗垎鏋愬け璐�: " + e.Message);
- }
- }
-#endregion
-#endif
-
+ // 3. 鍒嗘瀽骞剁粍鍚堝寘闃熷垪
vPackList = AnalysisPackQueueAndDistribute(guid, vPackList);
#if UNITY_EDITOR
-#region Start Print Pack List Detail
- if (Launch.Instance.isOpenSkillLogFile)
- {
- try
- {
- string detailAnalysis = PrintPackageDetailAnalysis(vPackList, guid);
- string filePath = Application.dataPath + "/../BattleReport/PackageAfterDetailAnalysis_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt";
- System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(filePath));
- System.IO.File.WriteAllText(filePath, detailAnalysis);
- Debug.Log("鍖呰缁嗗垎鏋愬凡淇濆瓨鍒�: " + filePath);
- }
- catch (Exception e)
- {
- Debug.LogError("淇濆瓨鍖呰缁嗗垎鏋愬け璐�: " + e.Message);
- }
- }
-#endregion
+ // 4. 淇濆瓨瑙f瀽鍚庣殑鍖呰鎯咃紙璋冭瘯鐢級
+ SavePackageDetailAfterAnalysis(vPackList, guid);
#endif
- for (int i = 0; i < vPackList.Count; i++)
- {
- BattleManager.Instance.PushPackage(guid, vPackList[i]);
- }
+ // 5. 灏嗗寘鎺ㄩ�佸埌鎴樺満闃熷垪
+ PushPackagesToBattle(guid, vPackList);
+
+ // 6. 閫氱煡鎴樺満寮�濮嬪垎鍙戝寘
canAddPack = false;
BattleManager.Instance.DistributeNextReportPackage(guid);
}
@@ -196,9 +58,135 @@
}
}
+ /// <summary>
+ /// 瑙f瀽鎴樻姤瀛楄妭娴侊紝鎻愬彇鎵�鏈夋垬鏂楁暟鎹寘
+ /// 绾﹀畾锛欱430 鍐呭鏍煎紡涓猴紙灏忓寘1闀垮害WORD + 鍖�1 + 灏忓寘2闀垮害WORD + 鍖�2...锛�
+ /// </summary>
+ private List<GameNetPackBasic> ParseReportBytes(byte[] reportBytes, string guid)
+ {
+ List<GameNetPackBasic> vPackList = new List<GameNetPackBasic>();
+ int vReadIndex = 0;
+ int vTotalLeng = reportBytes.Length;
+
+ while (vReadIndex < vTotalLeng)
+ {
+ int vLeavingLeng = vTotalLeng - vReadIndex;
+
+ // 鍖呭ご鑷冲皯闇�瑕�4瀛楄妭
+ if (vLeavingLeng < 4)
+ {
+ Debug.LogError("DTCB430_tagSCTurnFightReport: vLeavingLeng < 2 瑙e寘澶辫触");
+ break;
+ }
+
+ // 璇诲彇鍖呬綋闀垮害
+ int vBodyLeng = BitConverter.ToInt16(reportBytes, vReadIndex);
+ if (vBodyLeng > vLeavingLeng)
+ {
+ Debug.LogError("DTCB430_tagSCTurnFightReport: vBodyLeng > vLeavingLeng瑙e寘澶辫触");
+ break;
+ }
+
+ // 鎻愬彇鍖呬綋鏁版嵁
+ byte[] vPackBytes = new byte[vBodyLeng];
+ Array.Copy(reportBytes, vReadIndex + 2, vPackBytes, 0, vBodyLeng);
+
+ // 瑙f瀽鍖呯被鍨嬪懡浠�
+ Array.Copy(vPackBytes, 0, vCmdBytes, 0, 2);
+ var cmd = (ushort)((ushort)(vCmdBytes[0] << 8) + vCmdBytes[1]);
+
+ // 杞崲涓烘父鎴忓寘瀵硅薄
+ if (PackageRegedit.Contain(cmd))
+ {
+ GameNetPackBasic npk = PackageRegedit.TransPack(ServerType.B430, cmd, vPackBytes);
+ if (npk != null && !FilterBeforeB424(npk))
+ {
+ npk.socketType = ServerType.B430;
+ vPackList.Add(npk);
+ BattleManager.Instance.PushPackUID(guid, npk.packUID);
+ }
+ }
+#if UNITY_EDITOR
+ else
+ {
+ PackageRegedit.TransPack(ServerType.B430, cmd, vPackBytes);
+ }
+#endif
+
+ vReadIndex += 2 + vBodyLeng;
+ }
+
+ return vPackList;
+ }
+
+ /// <summary>
+ /// 淇濆瓨瑙f瀽鍓嶇殑鍖呰鎯呭埌鏂囦欢锛堜粎鍦ㄧ紪杈戝櫒涓斿紑鍚棩蹇楁椂锛�
+ /// </summary>
+ private void SavePackageDetailBeforeAnalysis(List<GameNetPackBasic> vPackList, string guid)
+ {
+#if UNITY_EDITOR
+ if (Launch.Instance.isOpenSkillLogFile)
+ {
+ try
+ {
+ string detailAnalysis = PrintPackageDetailAnalysis(vPackList, guid);
+ string filePath = Application.dataPath + "/../BattleReport/PackageBeforeDetailAnalysis_" +
+ DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt";
+ System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(filePath));
+ System.IO.File.WriteAllText(filePath, detailAnalysis);
+ Debug.Log("鍖呰缁嗗垎鏋愬凡淇濆瓨鍒�: " + filePath);
+ }
+ catch (Exception e)
+ {
+ Debug.LogError("淇濆瓨鍖呰缁嗗垎鏋愬け璐�: " + e.Message);
+ }
+ }
+
+ DebugingBuffStatus(vPackList);
+#endif
+ }
+
+ /// <summary>
+ /// 淇濆瓨瑙f瀽鍚庣殑鍖呰鎯呭埌鏂囦欢锛堜粎鍦ㄧ紪杈戝櫒涓斿紑鍚棩蹇楁椂锛�
+ /// </summary>
+ private void SavePackageDetailAfterAnalysis(List<GameNetPackBasic> vPackList, string guid)
+ {
+#if UNITY_EDITOR
+ if (Launch.Instance.isOpenSkillLogFile)
+ {
+ try
+ {
+ string detailAnalysis = PrintPackageDetailAnalysis(vPackList, guid);
+ string filePath = Application.dataPath + "/../BattleReport/PackageAfterDetailAnalysis_" +
+ DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt";
+ System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(filePath));
+ System.IO.File.WriteAllText(filePath, detailAnalysis);
+ Debug.Log("鍖呰缁嗗垎鏋愬凡淇濆瓨鍒�: " + filePath);
+ }
+ catch (Exception e)
+ {
+ Debug.LogError("淇濆瓨鍖呰缁嗗垎鏋愬け璐�: " + e.Message);
+ }
+ }
+#endif
+ }
+
+ /// <summary>
+ /// 灏嗘墍鏈夊寘鎺ㄩ�佸埌鎴樺満绠$悊鍣ㄩ槦鍒�
+ /// </summary>
+ private void PushPackagesToBattle(string guid, List<GameNetPackBasic> vPackList)
+ {
+ for (int i = 0; i < vPackList.Count; i++)
+ {
+ BattleManager.Instance.PushPackage(guid, vPackList[i]);
+ }
+ }
#if UNITY_EDITOR
-
+ /// <summary>
+ /// 璋冭瘯杈撳嚭Buff鐘舵�佸彉鏇存棩蹇楀埌鏂囦欢
+ /// 鍖呮嫭Buff鍒锋柊鍜屽垹闄ょ殑璇︾粏淇℃伅锛屾寜鑻遍泟鍒嗙粍
+ /// </summary>
private void DebugingBuffStatus(List<GameNetPackBasic> vPackList)
{
if (!Launch.Instance.isOpenSkillLogFile)
@@ -322,9 +310,12 @@
System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(filePath));
System.IO.File.WriteAllText(filePath, debugInfo);
}
-
#endif
+ /// <summary>
+ /// 鎵撳嵃鍖呭垪琛ㄧ殑璇︾粏淇℃伅锛屾敮鎸侀�掑綊灞曞紑瀛愬寘
+ /// 鐢ㄤ簬璋冭瘯鎴樻枟鍖呯殑灞傜骇缁撴瀯鍜屽唴瀹�
+ /// </summary>
private string PrintPackListDetail(List<GameNetPackBasic> packList, int indent, string guid = "")
{
string result = string.Empty;
@@ -412,39 +403,6 @@
result += $"{indentStr} [{j}] ExTarget - ObjID:{hurtEx.ObjID} Name:{targetExName} HurtHP:{hurtEx.HurtHP} AttackTypes:{hurtEx.AttackTypes}\n";
}
}
-
- // 鎵撳嵃瀛愭妧鑳藉垪琛�
- if (skill.subSkillList != null && skill.subSkillList.Count > 0)
- {
- result += $"{indentStr} SubSkills ({skill.subSkillList.Count}):\n";
- int j = 0;
- foreach (var subSkill in skill.subSkillList)
- {
- string subSkillName = SkillConfig.Get((int)subSkill.SkillID)?.SkillName ?? "Unknown";
- result += $"{indentStr} [{j}] SubSkill - SkillID:{subSkill.SkillID} SkillName:{subSkillName} RelatedSkillID:{subSkill.RelatedSkillID}\n";
- j++;
- }
- }
-
- // 鎵撳嵃瀛愭妧鑳紺ombinePack鍒楄〃
- if (skill.subSkillCombinePackList != null && skill.subSkillCombinePackList.Count > 0)
- {
- result += $"{indentStr} SubSkillCombinePacks ({skill.subSkillCombinePackList.Count}):\n";
- int j = 0;
- foreach (var subCombinePack in skill.subSkillCombinePackList)
- {
- var subMainSkill = subCombinePack.GetMainHB427SkillPack();
- string subMainSkillName = subMainSkill != null ? (SkillConfig.Get((int)subMainSkill.SkillID)?.SkillName ?? "Unknown") : "N/A";
- result += $"{indentStr} [{j}] SubCombinePack - Tag:{subCombinePack.startTag?.Tag} MainSkill:{subMainSkill?.SkillID} SkillName:{subMainSkillName} PackCount:{subCombinePack.packList.Count}\n";
-
- // 閫掑綊鎵撳嵃瀛怌ombinePack鍐呴儴
- if (subCombinePack.packList.Count > 0)
- {
- result += PrintPackListDetail(subCombinePack.packList, indent + 3, guid);
- }
- j++;
- }
- }
}
else if (pack is CustomHB426CombinePack combinePack)
{
@@ -493,7 +451,10 @@
return result;
}
- //绾﹀畾绗竴涓寘鏄疊424锛屽厛鍙戣繃鏉ョ殑杩囨护鎶ラ敊閫氱煡
+ /// <summary>
+ /// 杩囨护B424鍒濆鍖栧寘涔嬪墠鐨勬墍鏈夊寘
+ /// 绾﹀畾绗竴涓寘蹇呴』鏄疊424锛屼箣鍓嶇殑鍖呴兘鏄敊璇暟鎹渶瑕佽繃婊�
+ /// </summary>
bool FilterBeforeB424(GameNetPackBasic npk)
{
if (npk is HB424_tagSCTurnFightInit)
@@ -510,7 +471,10 @@
return false;
}
-
+ /// <summary>
+ /// 鍒嗘瀽骞堕噸缁勫寘闃熷垪
+ /// 灏嗘湇鍔″櫒鍘熷鍖呭垪琛ㄨ浆鎹负瀹㈡埛绔彲鎵ц鐨勬垬鏂楀寘缁撴瀯
+ /// </summary>
protected List<GameNetPackBasic> AnalysisPackQueueAndDistribute(string guid, List<GameNetPackBasic> vPackList)
{
// 寤鸿鍓嶇鍋氫竴涓槻鑼冩満鍒讹細褰撹繛缁娆¤姹傚緱鍒扮┖鐨勬垬鏂楃墖娈靛皝鍖呮椂锛堜笉鍖呭惈B425鏍囪鐨勫紑濮嬭窡缁撴潫灏佸寘锛屽嵆寮�濮嬭窡涓棿娌℃湁浠讳綍灏佸寘锛夛紝寮哄埗鑷姩甯帺瀹跺洖鍩庝紤鎭紝
@@ -518,72 +482,21 @@
// 涓洪槻姝㈡寰幆锛屽彲寮哄埗鍥炲煄浼戞伅锛岃鐜╁閲嶆柊鐐瑰嚮鍏冲崱鎴樻枟鎴栨寫鎴榖oss锛�
// 姝e父鎯呭喌涓嬪湪鎴橀敜瓒冲鏃剁悊璁轰笂閮藉彲浠ヤ竴鐩村惊鐜埛鎬紝濡傛灉杩炵画澶氭娌℃湁鎴樻枟鐗囨灏佸寘锛屾瘮濡傞檺鍒朵釜杩炵画10娆′互鍐咃紝灏卞彲浠ョ悊瑙d负寮傚父浜�
- // const int MaxContinousEmptyCount = 10; // 杩炵画绌哄寘鏈�澶ф鏁�
-
List<GameNetPackBasic> packQueueSnapshot = new List<GameNetPackBasic>(vPackList);
-
List<GameNetPackBasic> newPackList = BattleManager.ParseBattlePackList(guid, packQueueSnapshot);
- // List<GameNetPackBasic> newPackList = new List<GameNetPackBasic>();
- // HashSet<int> skipIndexes = new HashSet<int>();
-
- // // 杩欓噷宸茬粡鏄寜鐓equeue鐨勯『搴忎簡
- // for (int i = 0; i < packQueueSnapshot.Count; i++)
- // {
- // if (skipIndexes.Contains(i)) continue;
-
- // GameNetPackBasic pack = packQueueSnapshot[i];
-
- // // 纰板埌B421 鎴柇 寰�涓嬫敹闆哹421閲岀殑鍏ㄩ儴鍐呭
- // if (pack is HB421_tagMCTurnFightObjAction)
- // {
- // HB421_tagMCTurnFightObjAction b421Pack = pack as HB421_tagMCTurnFightObjAction;
-
- // List<GameNetPackBasic> b421PackList = new List<GameNetPackBasic>();
- // i++; // 璺宠繃褰撳墠鐨凚421鍖�
-
- // // 鏀堕泦鎵�鏈夐潪B421鍖咃紝鐩村埌閬囧埌涓嬩竴涓狟421鎴栭槦鍒楃粨鏉�
- // for (; i < packQueueSnapshot.Count; i++)
- // {
- // GameNetPackBasic nextPack = packQueueSnapshot[i];
- // if (nextPack is HB421_tagMCTurnFightObjAction)
- // {
- // i--; // 鍥為��涓�涓綅缃紝鐣欑粰澶栧眰寰幆澶勭悊
- // break;
- // }
- // else
- // {
- // b421PackList.Add(nextPack);
- // skipIndexes.Add(i); // 鏍囪宸茶鍚堝寘
- // }
- // }
-
-
-
- // // 鍚堝苟鎵�鏈夌浉鍏冲寘
- // CustomB421ActionPack actionPack = CustomB421ActionPack.CreateB421ActionPack(guid, b421PackList);
-
- // newPackList.Add(actionPack);
- // }
- // else
- // {
- // newPackList.Add(pack);
- // }
- // }
-
List<GameNetPackBasic> returnList = new List<GameNetPackBasic>();
for (int i = 0; i < newPackList.Count; i++)
{
- var pack = newPackList[i];
-
- returnList.Add(pack);
+ returnList.Add(newPackList[i]);
}
return returnList;
}
#if UNITY_EDITOR
/// <summary>
- /// 娣卞害瑙f瀽鍖呭垪琛ㄤ腑鐨勬墍鏈夊瓧娈�
+ /// 娣卞害瑙f瀽鎴樻姤鍖呭垪琛ㄧ殑鎵�鏈夊瓧娈�
+ /// 鐢熸垚璇︾粏鐨勫寘鍐呭鍒嗘瀽鎶ュ憡锛屽寘鎷墍鏈夊瓧娈靛��
/// </summary>
private string PrintPackageDetailAnalysis(List<GameNetPackBasic> packList, string guid)
{
@@ -608,6 +521,7 @@
/// <summary>
/// 閫掑綊鎵撳嵃瀵硅薄鐨勬墍鏈夊瓧娈靛拰灞炴��
+ /// 鏀寔鍩烘湰绫诲瀷銆佹暟缁勩�侀泦鍚堛�佽嚜瀹氫箟绫诲瀷绛�
/// </summary>
private void PrintObjectDetail(StringBuilder sb, object obj, int indent, BattleField battleField, HashSet<object> visitedObjects)
{
@@ -787,7 +701,8 @@
}
/// <summary>
- /// 鍒ゆ柇鏄惁涓虹畝鍗曠被鍨嬶紙鐩存帴杈撳嚭鍊硷級
+ /// 鍒ゆ柇绫诲瀷鏄惁涓虹畝鍗曠被鍨嬶紙鍩烘湰绫诲瀷銆佸瓧绗︿覆銆佹灇涓剧瓑锛�
+ /// 绠�鍗曠被鍨嬪彲浠ョ洿鎺ヨ緭鍑哄�硷紝涓嶉渶瑕侀�掑綊灞曞紑
/// </summary>
private bool IsSimpleType(Type type)
{
@@ -799,7 +714,8 @@
}
/// <summary>
- /// 鍒ゆ柇鏄惁搴旇璺宠繃璇ョ被鍨嬶紙Unity鍜孲ystem搴撶殑澶嶆潅绫诲瀷锛�
+ /// 鍒ゆ柇绫诲瀷鏄惁搴旇璺宠繃瑙f瀽
+ /// Unity鍜孲ystem搴撶殑澶嶆潅绫诲瀷浼氳璺宠繃浠ユ彁楂樻�ц兘
/// </summary>
private bool ShouldSkipType(Type type)
{
@@ -822,7 +738,8 @@
}
/// <summary>
- /// 鑾峰彇缂╄繘瀛楃涓�
+ /// 鐢熸垚鎸囧畾缂╄繘绾у埆鐨勭┖鏍煎瓧绗︿覆
+ /// 鐢ㄤ簬鏍煎紡鍖栬緭鍑虹殑灞傜骇缁撴瀯
/// </summary>
private string GetIndent(int indent)
{
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index c678e89..4bd3dd8 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -510,8 +510,9 @@
}
}
- public virtual void OnObjsDead(List<BattleDeadPack> deadPackList, RecordAction causingRecordAction = null)
+ public virtual DeathRecordAction OnObjsDead(List<BattleDeadPack> deadPackList, RecordAction _causingRecordAction = null)
{
+ DeathRecordAction deathRecordAction = null;
if (deadPackList.Count > 0)
{
// 杩囨护鎺夋鍦ㄥ鐞嗘浜$殑瑙掕壊锛岄伩鍏嶉噸澶嶅鐞�
@@ -546,19 +547,12 @@
// 鍙鐞嗘湁鏁堢殑姝讳骸娑堟伅
if (validDeadList.Count > 0)
{
- DeathRecordAction recordAction = new DeathRecordAction(this, validDeadList, causingRecordAction);
- // 濡傛灉鏈夊鑷存浜$殑鎶�鑳斤紝灏咲eathRecordAction浣滀负鍏跺瓙鑺傜偣锛屽苟璁剧疆涓篧aitingPlay
- if (causingRecordAction != null)
- {
- recordPlayer.ImmediatelyPlay(recordAction, causingRecordAction, true);
- }
- else
- {
- recordPlayer.ImmediatelyPlay(recordAction);
- }
+ DeathRecordAction recordAction = new DeathRecordAction(this, validDeadList, _causingRecordAction);
+ deathRecordAction = recordAction;
}
}
+ return deathRecordAction;
}
public virtual void OnObjReborn(uint objId)
diff --git a/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
index f1ef77c..0951bc9 100644
--- a/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
@@ -15,8 +15,6 @@
protected Dictionary<int, bool> dropStateDict = new Dictionary<int, bool>();
- protected RecordAction causingRecordAction = null;
-
protected bool hasDeathTriggerSkill = false;
// 鏍囪鏄惁宸茬粡鍒嗗彂浜嗘浜″悗鐨勫寘
@@ -26,8 +24,16 @@
: base(RecordActionType.Death, _battleField, null)
{
deadPackList = _deadPackList;
- causingRecordAction = _causingRecordAction;
CheckHasDeathTriggerSkill();
+
+ for (int i = 0; i < deadPackList.Count; i++)
+ {
+ BattleObject battleObject = battleField.battleObjMgr.GetBattleObject((int)deadPackList[i].deadPack.ObjID);
+ Debug.LogError($"DeathRecordAction: 鍒濆鍖栨浜″姩浣滐紝姝讳骸瀵硅薄鍚嶅瓧={battleObject?.teamHero.name}, hasDeathTriggerSkill={deadPackList[i].deadTriggerSkill != null}");
+ }
+
+ SetParentAction(_causingRecordAction);
+
}
protected void CheckHasDeathTriggerSkill()
@@ -45,6 +51,8 @@
public override void Run()
{
+ base.Run();
+
// 璇ユ鐨勬甯告
// 鏈夋妧鑳界殑鍒欐寜鐓ч『搴忔挱鏀炬浜℃妧鑳� 鍚庡啀姝e父姝�
if (isFinish)
@@ -70,7 +78,7 @@
// 浣跨敤ImmediatelyPlay骞惰缃甒aitingPlay=true锛屽彲浠ヨ姝讳骸鎶�鑳界瓑寰呭鑷存浜$殑鎶�鑳藉畬鎴�
// 濡傛灉DeathRecordAction鏈夌埗鑺傜偣锛堝鑷存浜$殑鎶�鑳斤級锛屽垯绛夊緟閭d釜鐖惰妭鐐�
// 鍚﹀垯绛夊緟DeathRecordAction鏈韩
- battleField.recordPlayer.ImmediatelyPlay(skillAction, causingRecordAction == null ? this : causingRecordAction, true);
+ battleField.recordPlayer.ImmediatelyPlay(skillAction, parentAction == null ? this : parentAction, true);
}
}
else
@@ -137,9 +145,9 @@
}
// 纭繚鍦╥nnerRecordPlayer涓墽琛屾浜″悗鐨勫寘
- if (hasDistributedPacksAfterDeath && causingRecordAction != null)
+ if (hasDistributedPacksAfterDeath && parentAction != null)
{
- var innerPlayer = causingRecordAction.GetInnerRecordPlayer();
+ var innerPlayer = parentAction.GetInnerRecordPlayer();
if (innerPlayer != null && innerPlayer.IsPlaying())
{
innerPlayer.Run();
@@ -163,16 +171,38 @@
return () => true;
}
- PerformDrop(deadObj);
+ bool playDeath = false;
bool isComplete = false;
- deadObj.OnDeath(() => {
- isComplete = true;
- }, withoutAnime);
+ // 濡傛灉娌℃湁閲婃斁鎶�鑳� 鍒欑洿鎺ユ浜�
+ if (!battleField.IsCastingSkill(deadObj.ObjID))
+ {
+ PerformDrop(deadObj);
+
+ deadObj.OnDeath(() => {
+ isComplete = true;
+ }, withoutAnime);
+
+ playDeath = true;
+ }
+
+
return () =>
{
+ // 杩樻病鎾斁姝讳骸 骞朵笖娌¢噴鏀惧叾浠栨妧鑳�
+ if (!playDeath && !battleField.IsCastingSkill(deadObj.ObjID))
+ {
+ PerformDrop(deadObj);
+
+ deadObj.OnDeath(() => {
+ isComplete = true;
+ }, withoutAnime);
+
+ playDeath = true;
+ }
+
if (deadObj.isReborning)
{
isComplete = true;
@@ -247,8 +277,6 @@
{
if (deadPack.packListAfterDeath != null && deadPack.packListAfterDeath.Count > 0)
{
- BattleDebug.LogError($"DeathRecordAction.DistributePacksAfterDeath: 寮�濮嬪垎鍙戞浜″悗鐨勫寘锛屽叡 {deadPack.packListAfterDeath.Count} 涓寘");
-
foreach (var pack in deadPack.packListAfterDeath)
{
// 鑾峰彇鍖呯殑绫诲瀷鍜孶ID鐢ㄤ簬璋冭瘯
@@ -260,33 +288,37 @@
packUID = (ulong)packUIDField.GetValue(pack);
}
- BattleDebug.LogError($"DeathRecordAction: 鍒嗗彂姝讳骸鍚庣殑鍖� - Type: {packType}, UID: {packUID}, causingRecordAction: {causingRecordAction?.GetType().Name}");
// 鐗规畩澶勭悊 CustomHB426CombinePack锛氫娇鐢ㄥ叾鑷繁鐨� Distribute 鏂规硶
if (pack is CustomHB426CombinePack combinePack)
{
- BattleDebug.LogError($"DeathRecordAction: 姝讳骸鍚庣殑鍖呮槸 CustomHB426CombinePack锛屼娇鐢ㄥ叾 Distribute 鏂规硶");
- combinePack.Distribute();
+ combinePack.Distribute(parentAction);
}
// 鐗规畩澶勭悊 HB427_tagSCUseSkill锛氬垱寤烘妧鑳藉寘骞跺垎鍙�
else if (pack is HB427_tagSCUseSkill skillPack)
{
- BattleDebug.LogError($"DeathRecordAction: 姝讳骸鍚庣殑鍖呮槸 HB427_tagSCUseSkill锛屽垱寤� SkillRecordAction");
var skillAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic>() { skillPack });
if (skillAction != null)
{
- battleField.PlayRecord(skillAction);
+ if (parentAction != null)
+ {
+ parentAction.GetInnerRecordPlayer().PlayRecord(skillAction);
+ }
+ else
+ {
+ battleField.PlayRecord(skillAction);
+ }
}
}
else
{
// 銆愪娇鐢� causingRecordAction 鎴� battleField.recordPlayer銆�
// 鍘熷洜锛氭浜″悗鐨勫寘搴旇鍥炲埌瀵艰嚧姝讳骸鐨勬妧鑳芥墍鍦ㄧ殑涓婁笅鏂�
- // 濡傛灉鏈� causingRecordAction锛堝鑷存浜$殑鎶�鑳斤級锛屽垯鍒嗗彂鍒板畠鐨� innerRecordPlayer
+ // 濡傛灉鏈� parentAction锛堝鑷存浜$殑鎶�鑳斤級锛屽垯鍒嗗彂鍒板畠鐨� innerRecordPlayer
// 鍚﹀垯鍒嗗彂鍒� battleField.recordPlayer锛堥《灞傦級
- if (causingRecordAction != null)
+ if (parentAction != null)
{
- PackageRegeditEx.DistributeToRecordAction(pack, causingRecordAction);
+ PackageRegeditEx.DistributeToRecordAction(pack, parentAction);
}
else
{
@@ -295,6 +327,9 @@
}
}
}
+
+ // 鍒嗗彂瀹屾垚鍚庢竻鐞嗗垪琛紝闃叉閲嶅鍒嗗彂鍜屽唴瀛樻硠婕�
+ deadPack.packListAfterDeath.Clear();
}
}
}
@@ -333,4 +368,30 @@
{
return HasDeathTriggerSkill();
}
+
+#if UNITY_EDITOR
+ /// <summary>
+ /// 棣栨杩愯鏃舵墦鍗版棩蹇楋紙浠呯紪杈戝櫒锛�
+ /// 鎵撳嵃姝讳骸瀵硅薄鐨勫悕瀛�
+ /// </summary>
+ protected override void PrintFirstRunLog()
+ {
+ if (deadPackList != null && deadPackList.Count > 0)
+ {
+ string deadNames = "";
+ foreach (var deadPack in deadPackList)
+ {
+ BattleObject deadObj = battleField.battleObjMgr.GetBattleObject((int)deadPack.deadPack.ObjID);
+ string name = deadObj?.teamHero?.name ?? "Unknown";
+ deadNames += name + ",";
+ }
+ deadNames = deadNames.TrimEnd(',');
+ Debug.LogError($"[DeathRecordAction棣栨Run] 姝讳骸瀵硅薄:{deadNames} 鏁伴噺:{deadPackList.Count}");
+ }
+ else
+ {
+ base.PrintFirstRunLog();
+ }
+ }
+#endif
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
index b0eb08f..fcfe947 100644
--- a/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
@@ -15,16 +15,30 @@
private Sequence tweenSeq = DOTween.Sequence();
+ private List<BattleObject> rebornObjs = new List<BattleObject>();
- public RebornRecordAction(BattleField _battleField, BattleObject rebornObj, Action _callback)
- : base(RecordActionType.Reborn, _battleField, rebornObj)
+
+ public RebornRecordAction(BattleField _battleField, List<BattleObject> _rebornObjs, Action _callback)
+ : base(RecordActionType.Reborn, _battleField, null)
{
+ if (_rebornObjs != null)
+ {
+ foreach (var obj in _rebornObjs)
+ {
+ if (obj != null)
+ {
+ rebornObjs.Add(obj);
+ }
+ }
+ }
actionCallback = _callback;
}
public override void Run()
{
+ base.Run();
+
if (isFinish)
return;
@@ -45,23 +59,45 @@
// 鍋氫竴涓粠閫忔槑鍒版仮澶嶇殑娓愬彉鐨勫悓鏃� 鎾斁鐗规晥
public void PlayRebornEffect()
{
- // 鎾斁澶嶆椿鐗规晥
- battleField.battleEffectMgr.PlayEffect(battleObject, BattleConst.RebornEffectID, battleObject.heroRectTrans, battleObject.Camp, battleObject.teamHero.modelScale);
-
- // 娓愬彉
- battleObject.motionBase.skeletonAnim.skeleton.A = 0f;
+ if (rebornObjs.Count == 0)
+ {
+ actionCallback?.Invoke();
+ actionCallback = null;
+ isActionCompleted = true;
+ isFinish = true;
+ return;
+ }
battleField.battleTweenMgr.OnKillTween(tweenSeq);
+
tweenSeq = DOTween.Sequence();
- tweenSeq.Append(DOVirtual.Float(0f, 1f, tweenDuration / battleField.speedRatio, value =>
+ foreach (var bo in rebornObjs)
{
- battleObject.motionBase.skeletonAnim.skeleton.A = value;
- }));
+ var battleObj = bo;
+ Sequence sequence = DOTween.Sequence();
+
+ // 鎾斁澶嶆椿鐗规晥
+ battleField.battleEffectMgr.PlayEffect(battleObj, BattleConst.RebornEffectID, battleObj.heroRectTrans, battleObj.Camp, battleObj.teamHero.modelScale);
+
+ // 娓愬彉
+ battleObj.motionBase.skeletonAnim.skeleton.A = 0f;
+
+ sequence.Append(DOVirtual.Float(0f, 1f, tweenDuration / battleField.speedRatio, value =>
+ {
+ battleObj.motionBase.skeletonAnim.skeleton.A = value;
+ }));
+
+ tweenSeq.Join(sequence);
+ }
tweenSeq.Append(DOVirtual.DelayedCall(keepDuration / battleField.speedRatio, () =>
{
- battleObject?.AfterReborn();
+ foreach (var bo in rebornObjs)
+ {
+ var battleObj = bo;
+ battleObj?.AfterReborn();
+ }
actionCallback?.Invoke();
actionCallback = null;
isActionCompleted = true; // 鏍囪鍔ㄤ綔瀹屾垚
@@ -81,9 +117,12 @@
battleField.battleTweenMgr.OnKillTween(tweenSeq);
- battleObject.motionBase.skeletonAnim.skeleton.A = 1f;
-
- battleObject?.AfterReborn();
+ foreach (var bo in rebornObjs)
+ {
+ var battleObj = bo;
+ battleObj.motionBase.skeletonAnim.skeleton.A = 1f;
+ battleObj.AfterReborn();
+ }
actionCallback?.Invoke();
diff --git a/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
index f7335ed..a723234 100644
--- a/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
@@ -3,7 +3,12 @@
public class SkillRecordAction : RecordAction
{
- protected SkillBase skillBase;
+#if UNITY_EDITOR
+ public
+#else
+ protected
+#endif
+ SkillBase skillBase;
public HB427_tagSCUseSkill hB427_TagSCUseSkill;
@@ -28,6 +33,13 @@
skillBase.SetParentRecordAction(this);
}
}
+
+ public override void AfterAddToQueue()
+ {
+ base.AfterAddToQueue();
+ skillBase?.AfterAddToQueue();
+ }
+
public override bool IsNeedWaiting()
{
if (skillBase == null)
@@ -92,7 +104,6 @@
return base.CanStartExecution();
}
-
public override void Run()
{
base.Run();
@@ -121,4 +132,25 @@
isCast = true;
}
}
+
+#if UNITY_EDITOR
+ /// <summary>
+ /// 棣栨杩愯鏃舵墦鍗版棩蹇楋紙浠呯紪杈戝櫒锛�
+ /// 鎵撳嵃鏂芥硶鑰呭悕瀛椼�佹妧鑳絀D鍜屾妧鑳藉悕瀛�
+ /// </summary>
+ protected override void PrintFirstRunLog()
+ {
+ if (skillBase != null && skillBase.caster != null)
+ {
+ string casterName = skillBase.caster.teamHero?.name ?? "Unknown";
+ int skillId = skillBase.skillConfig?.SkillID ?? 0;
+ string skillName = skillBase.skillConfig?.SkillName ?? "Unknown";
+ Debug.LogError($"[SkillRecordAction棣栨Run] 鏂芥硶鑰�:{casterName} 鎶�鑳絀D:{skillId} 鎶�鑳藉悕:{skillName}");
+ }
+ else
+ {
+ base.PrintFirstRunLog();
+ }
+ }
+#endif
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index 0c3f244..597c6f8 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -192,10 +192,6 @@
{
temp += " pack type is " + pack.GetType().Name + " tag is " + (b426Pack.startTag != null ? b426Pack.startTag.Tag : "null") + "\n";
}
- else if (pack is CustomB421ActionPack b421Pack)
- {
- temp += " pack type is " + pack.GetType().Name + " guid is " + b421Pack.guid + "\n";
- }
else
{
temp += " pack type is " + pack.GetType().Name + "\n";
@@ -336,10 +332,6 @@
if (pack is CustomHB426CombinePack combinePack)
{
combinePack.Distribute();
- }
- else if (pack is CustomB421ActionPack actionPack)
- {
- actionPack.Distribute();
}
else
{
@@ -482,10 +474,6 @@
if (pack is CustomHB426CombinePack combinePack)
{
combinePack.Distribute();
- }
- else if (pack is CustomB421ActionPack actionPack)
- {
- actionPack.Distribute();
}
else
{
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index 58154a9..57a8eac 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -315,8 +315,9 @@
return true;
}
- public virtual void Hurt(BattleHurtParam battleHurtParam, RecordAction causingRecordAction = null)
+ public virtual RecordAction Hurt(BattleHurtParam battleHurtParam, RecordAction _causingRecordAction = null)
{
+ RecordAction recordAction = null;
bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1;
bool firstHit = battleHurtParam.hitIndex == 0;
@@ -356,7 +357,7 @@
{
PushDropItems(battleHurtParam.battleDrops);
}
- battleField.OnObjsDead(new List<BattleDeadPack>() { battleHurtParam.deadPack }, causingRecordAction);
+ recordAction = battleField.OnObjsDead(new List<BattleDeadPack>() { battleHurtParam.deadPack }, _causingRecordAction);
}
else
@@ -378,6 +379,8 @@
// }
}
+
+ return recordAction;
}
/// <summary>
@@ -493,7 +496,7 @@
}
// 澶嶆椿action
- public void OnReborn(HB427_tagSCUseSkill.tagSCUseSkillHurt vNetData, bool reviveSelf = false)
+ public void OnReborn(HB427_tagSCUseSkill.tagSCUseSkillHurt vNetData, bool reviveSelf = false, RecordAction parentAction = null)
{
isReborning = true;
heroGo.SetActive(true);
@@ -501,20 +504,7 @@
heroRectTrans.anchoredPosition = Vector2.zero;
motionBase.skeletonAnim.skeleton.A = 0f;
motionBase.skeletonAnim.LateUpdate();
- RebornRecordAction recordAction = new RebornRecordAction(battleField, this, () =>
- {
- battleField.OnObjReborn((uint)ObjID);
- teamHero.curHp = GeneralDefine.GetFactValue(vNetData.CurHP, vNetData.CurHPEx);
-
- // Debug.LogError("OnReborn " + teamHero.curHp);
- teamHero.isDead = false;
-
- });
- // 銆愪娇鐢� BattleField.recordPlayer銆�
- // 鍘熷洜锛氬娲绘槸瑙掕壊鐨勭嫭绔嬭涓猴紝涓嶆槸鎶�鑳藉唴閮ㄤ骇鐢熺殑
- // 澶嶆椿鍙兘鏄鍔ㄨЕ鍙戠殑锛堝姝讳骸鍚庢湇鍔″櫒鍙戞潵鐨勫娲诲寘锛夛紝搴旇鐢变富RecordPlayer绠$悊
- // 浣跨敤InsertRecord鍙互鎻掑埌闃熷垪鏈�鍓嶉潰锛屼繚璇佸娲昏〃鐜扮殑浼樺厛绾�
- battleField.recordPlayer.InsertRecord(recordAction);
+
}
public void AfterReborn()
diff --git a/Main/System/Battle/BattleTweenMgr.cs b/Main/System/Battle/BattleTweenMgr.cs
index 15628b4..794664f 100644
--- a/Main/System/Battle/BattleTweenMgr.cs
+++ b/Main/System/Battle/BattleTweenMgr.cs
@@ -56,9 +56,9 @@
tween.Play();
}
- public void OnKillTween(Tween tween)
+ public void OnKillTween(Tween tween, bool complete = false)
{
- tween?.Kill();
+ tween?.Kill(complete);
if (tween != null && tweenList.Contains(tween))
{
tweenList.Remove(tween);
diff --git a/Main/System/Battle/BattleUtility.cs b/Main/System/Battle/BattleUtility.cs
index 9f43f2b..bd52360 100644
--- a/Main/System/Battle/BattleUtility.cs
+++ b/Main/System/Battle/BattleUtility.cs
@@ -259,7 +259,7 @@
BattleObject target = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
if (target == null)
{
- Debug.LogError("GetMainTargetPositionNum 鎵句笉鍒扮洰鏍� ObjId : " + hurt.ObjID);
+ Debug.LogError("GetMainTargetPositionNum 鎵句笉鍒扮洰鏍� ObjId : " + hurt.ObjID + " skill id " + skillConfig.SkillID);
continue;
}
else
@@ -281,7 +281,7 @@
}
else
{
- Debug.LogError("GetMainTargetPositionNum 鎵句笉鍒拌窡闅忎富鎶�鑳界殑鐩爣");
+ Debug.LogError("GetMainTargetPositionNum 鎵句笉鍒拌窡闅忎富鎶�鑳界殑鐩爣 " + skillConfig.SkillID);
returnIndex = 0;
}
break;
diff --git a/Main/System/Battle/RecordPlayer/RecordAction.cs b/Main/System/Battle/RecordPlayer/RecordAction.cs
index 51e7167..444684d 100644
--- a/Main/System/Battle/RecordPlayer/RecordAction.cs
+++ b/Main/System/Battle/RecordPlayer/RecordAction.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System;
-
+using UnityEngine;
public class RecordAction
{
@@ -13,6 +13,12 @@
protected bool isFinish = false;
protected bool isRunOnce = false;
+
+#if UNITY_EDITOR
+ // 鏄惁宸叉墦鍗伴娆¤繍琛屾棩蹇楋紙浠呯敤浜庤皟璇曪級
+ private bool hasLoggedFirstRun = true;
+#endif
+
// ===== 鐖跺瓙鍏崇郴鍜岀瓑寰呮満鍒� =====
// 鐖禦ecordAction寮曠敤锛堝鏋滄槸閫氳繃鍏朵粬RecordAction鍐呴儴瑙﹀彂鐨勶級
@@ -37,6 +43,8 @@
// 3. 涓嶄細骞叉壈BattleField涓籖ecordPlayer鐨勬挱鏀鹃槦鍒�
protected RecordPlayer innerRecordPlayer;
+ public RecordPlayer actionOwner { get; set; }
+
public RecordAction(RecordActionType _actionType, BattleField _battleField, BattleObject _battleObj)
{
actionType = _actionType;
@@ -50,6 +58,11 @@
innerRecordPlayer = new RecordPlayer();
innerRecordPlayer.Init(_battleField);
}
+ }
+
+ public virtual void AfterAddToQueue()
+ {
+
}
public virtual void Played()
@@ -162,12 +175,32 @@
public virtual void Run()
{
+#if UNITY_EDITOR
+ // 棣栨杩愯鏃舵墦鍗拌皟璇曚俊鎭�
+ if (!hasLoggedFirstRun)
+ {
+ hasLoggedFirstRun = true;
+ PrintFirstRunLog();
+ }
+#endif
+
// 鍏堣繍琛屽唴閮≧ecordPlayer
// 鍘熷洜锛氬唴閮ㄤ骇鐢熺殑RecordAction闇�瑕佸厛鎵ц锛岀‘淇濆唴閮ㄩ�昏緫鎸夋纭『搴忔挱鏀�
// 渚嬪锛氭妧鑳藉唴閮ㄤ骇鐢熺殑Buff娣诲姞銆佸瓙鎶�鑳界瓑閮界敱innerRecordPlayer绠$悊
innerRecordPlayer?.Run();
}
+#if UNITY_EDITOR
+ /// <summary>
+ /// 棣栨杩愯鏃舵墦鍗版棩蹇楋紙浠呯紪杈戝櫒锛�
+ /// 瀛愮被鍙互閲嶅啓姝ゆ柟娉曡嚜瀹氫箟鎵撳嵃鍐呭
+ /// </summary>
+ protected virtual void PrintFirstRunLog()
+ {
+ Debug.LogError($"[RecordAction棣栨Run] {GetType().Name}");
+ }
+#endif
+
public virtual void ForceFinish()
{
isFinish = true;
diff --git a/Main/System/Battle/RecordPlayer/RecordPlayer.cs b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
index a5da9c6..68311a4 100644
--- a/Main/System/Battle/RecordPlayer/RecordPlayer.cs
+++ b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
@@ -43,6 +43,7 @@
public void PlayRecord(RecordAction recordAction)
{
if (recordAction == null) return;
+ recordAction.actionOwner = this;
// Debug.LogError("Enqueue record action " + recordAction.GetType() + " to queue");
if (isForceFinish || stepForcefinish)
{
@@ -50,6 +51,7 @@
return;
}
recordActionQueue.Enqueue(recordAction);
+ recordAction.AfterAddToQueue();
}
public void PlayRecord(List<RecordAction> recordActions)
@@ -60,9 +62,10 @@
}
}
- public void InsertRecord(RecordAction recordAction)
+ public void InsertRecord(RecordAction recordAction, int position = 0)
{
if (recordAction == null) return;
+ recordAction.actionOwner = this;
if (isForceFinish || stepForcefinish)
{
recordAction.ForceFinish();
@@ -73,22 +76,33 @@
if (currentRecordAction != null)
{
Queue<RecordAction> tempQueue = new Queue<RecordAction>();
+
+ for (int i = 0; i < position && recordActionQueue.Count > 0; i++)
+ {
+ tempQueue.Enqueue(recordActionQueue.Dequeue());
+ }
+
tempQueue.Enqueue(recordAction);
+
while (recordActionQueue.Count > 0)
{
tempQueue.Enqueue(recordActionQueue.Dequeue());
}
+
recordActionQueue = tempQueue;
}
else
{
recordActionQueue.Enqueue(recordAction);
}
+
+ recordAction.AfterAddToQueue();
}
public void ImmediatelyPlay(RecordAction recordAction)
{
if (recordAction == null) return;
+ recordAction.actionOwner = this;
if (isForceFinish || stepForcefinish)
{
recordAction.ForceFinish();
@@ -101,6 +115,7 @@
public void ImmediatelyPlay(RecordAction recordAction, RecordAction parentAction, bool isWaitingPlay)
{
if (recordAction == null) return;
+ recordAction.actionOwner = this;
if (isForceFinish || stepForcefinish)
{
recordAction.ForceFinish();
@@ -238,7 +253,16 @@
if (recordActionQueue.Count > 0)
{
currentRecordAction = recordActionQueue.Dequeue();
- // BattleDebug.LogError("play record action " + currentRecordAction.GetType());
+ #if UNITY_EDITOR
+ // if (currentRecordAction is SkillRecordAction skillRecordAction)
+ // {
+ // Debug.LogError("RecordPlayer Run Play SkillRecordAction skillname " + skillRecordAction.skillBase.skillConfig.SkillName + " caster " + skillRecordAction.skillBase.caster.teamHero.name);
+ // }
+ // else
+ #endif
+ {
+ BattleDebug.LogError("play record action " + currentRecordAction.GetType());
+ }
}
}
}
diff --git a/Main/System/Battle/Skill/RebornSkill.cs b/Main/System/Battle/Skill/RebornSkill.cs
index 0d2b5ff..1378fb3 100644
--- a/Main/System/Battle/Skill/RebornSkill.cs
+++ b/Main/System/Battle/Skill/RebornSkill.cs
@@ -14,17 +14,45 @@
}
+ public override void AfterAddToQueue()
+ {
+ base.AfterAddToQueue();
+ }
+
protected override void OnHitTargets(int _hitIndex, List<HB427_tagSCUseSkill.tagSCUseSkillHurt> hitList)
{
+ List<BattleObject> rebornTargets = new List<BattleObject>();
for (int i = 0; i < hitList.Count; i++)
{
var hurt = hitList[i];
BattleObject battleObject = battleField.battleObjMgr.GetBattleObject((int)hitList[i].ObjID);
if (battleObject != null)
{
- battleObject.OnReborn(hurt, hurt.ObjID == caster.teamHero.ObjID);
+ battleObject.OnReborn(hurt, hurt.ObjID == caster.teamHero.ObjID, parentRecordAction);
+ rebornTargets.Add(battleObject);
}
}
+
+ RebornRecordAction recordAction = new RebornRecordAction(battleField, rebornTargets, () =>
+ {
+ for (int i = 0; i < tagUseSkillAttack.HurtList.Length; i++)
+ {
+ var hurt = tagUseSkillAttack.HurtList[i];
+ BattleObject battleObject = battleField.battleObjMgr.GetBattleObject((int)tagUseSkillAttack.HurtList[i].ObjID);
+ if (battleObject != null)
+ {
+ battleField.OnObjReborn(tagUseSkillAttack.HurtList[i].ObjID);
+ battleObject.teamHero.curHp = GeneralDefine.GetFactValue(hurt.CurHP, hurt.CurHPEx);
+
+ // Debug.LogError("OnReborn " + teamHero.curHp);
+ battleObject.teamHero.isDead = false;
+ }
+ }
+ });
+
+
+ battleField.recordPlayer.ImmediatelyPlay(recordAction);
+
bool vValue = true;
@@ -80,20 +108,5 @@
return false;
}
- public override void OnMiddleFrameStart(int times)
- {
- skillEffect.OnMiddleFrameStart(times); // 淇锛氭坊鍔犵┖鍊兼鏌�
- }
-
- // 鎶�鑳戒腑鎽囩粨鏉熷洖璋冿細閫氱煡鎶�鑳芥晥鏋滃鐞嗕腑鎽囩粨鏉�
- public override void OnMiddleFrameEnd(int times, int hitIndex)
- {
- skillEffect.OnMiddleFrameEnd(times, hitIndex); // 淇锛氭坊鍔犵┖鍊兼鏌�
- }
-
- public override void OnFinalFrameEnd()
- {
- skillEffect?.OnFinalFrameEnd(); // 淇锛氭坊鍔犵┖鍊兼鏌�
- }
}
\ No newline at end of file
--
Gitblit v1.8.0