From b125ed00e7e0db3e5851bf535cf19aae46d4cc37 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 23 一月 2026 15:33:27 +0800
Subject: [PATCH] 125 战斗 战报检测+旧代码删除
---
/dev/null | 11 --
Main/System/Battle/RecordPlayer/RecordAction.cs | 2
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs | 40 ++++++++++
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB427_tagSCUseSkill.cs | 1
Main/System/Battle/Motion/MotionBase.cs | 40 ++++------
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs | 39 ++++-----
Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs | 69 +++++++++++++++++
7 files changed, 145 insertions(+), 57 deletions(-)
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index 913137e..9967f5c 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -18,6 +18,11 @@
public List<GameNetPackBasic> packList = new List<GameNetPackBasic>();
+#if UNITY_EDITOR
+ // 缂栬緫鍣ㄤ笅淇濆瓨packList鐨勫壇鏈紝閬垮厤distribute杩囩▼涓璻emove瀵艰嚧鏌ョ湅鍣ㄦ樉绀轰笉鍏�
+ public List<GameNetPackBasic> copiedPackList = new List<GameNetPackBasic>();
+#endif
+
private bool isCreated = false;
public override void ReadFromBytes(byte[] vBytes)
@@ -47,7 +52,6 @@
}
fromIndex = _fromIndex;
startTag = tag;
-
}
@@ -79,6 +83,11 @@
}
packList.Add(pack);
+
+#if UNITY_EDITOR
+ copiedPackList.Add(pack);
+#endif
+
}
public bool IsEndPack(HB426_tagSCTurnFightTag tag)
@@ -297,6 +306,7 @@
BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
SkillRecordAction skillAction = new SkillRecordAction(battleField, _caster, skill, _packList);
+ skillAction.tracePackUID = skill.packUID;
return skillAction;
}
@@ -331,6 +341,8 @@
else if (pack is CustomHB426CombinePack)
{
Debug.LogError("鏃犳硶鎵惧埌Skill鍖咃紝鍏堝彂鐜颁簡宓屽鍖� " + startTag.Tag);
+ // 淇濇寔鍘熸牱 涓嶅幓鍔ㄤ粬
+ packList.Insert(0, pack);
return null;
}
else
@@ -352,40 +364,24 @@
return null;
}
HB427_tagSCUseSkill skill = packList[0] as HB427_tagSCUseSkill;
-
-
- packList.RemoveAt(0);
if (null == skill)
{
Debug.LogError("No HB427_tagSCUseSkill found in packList.");
return null;
}
+ packList.RemoveAt(0);
+
+
BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
// BattleDebug.LogError("_caster == null : " + (_caster == null) + " skill.ObjID : " + skill.ObjID);
isCreated = true;
SkillRecordAction skillAction = new SkillRecordAction(battleField, _caster, skill, packList);
+ skillAction.tracePackUID = packUID;
return skillAction;
}
return null;
- }
-
-#if UNITY_EDITOR
- public static CustomHB426CombinePack CreateCustomPack(string _guid, HB427_tagSCUseSkill skill)
- {
- CustomHB426CombinePack pack = new CustomHB426CombinePack();
- pack.guid = string.Empty;
-
- pack.startTag = new HB426_tagSCTurnFightTag
- {
- Tag = "Skill_Start",
- Sign = 0
- };
-
- pack.packList.Add(skill);
-
- return pack;
}
public bool NeedWaiting()
@@ -424,5 +420,4 @@
return needWaiting;
}
-#endif
}
\ No newline at end of file
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB427_tagSCUseSkill.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB427_tagSCUseSkill.cs
index fd2d875..335a5d4 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB427_tagSCUseSkill.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB427_tagSCUseSkill.cs
@@ -27,6 +27,7 @@
}
SkillRecordAction skillRecord = new SkillRecordAction(battleField, caster, vNetData, new System.Collections.Generic.List<GameNetPackBasic>());
+ skillRecord.tracePackUID = vNetData.packUID;
battleField.PlayRecord(skillRecord);
}
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 8cd8c7f..6c122b7 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs
@@ -4,6 +4,7 @@
using System.Text;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
/// <summary>
/// B4 30 鎴樻姤缁撴灉澶勭悊绫�
@@ -168,6 +169,45 @@
Debug.LogError("淇濆瓨鍖呰缁嗗垎鏋愬け璐�: " + e.Message);
}
}
+
+ // 灏嗗寘鏁版嵁娣诲姞鍒版垬鏂楀寘鏌ョ湅鍣紙浣跨敤鍙嶅皠璋冪敤Editor绋嬪簭闆嗭級
+ try
+ {
+ // 鏌ユ壘鍖呭惈BattleReportChecker鐨凟ditor绋嬪簭闆�
+ Assembly editorAssembly = System.AppDomain.CurrentDomain.GetAssemblies()
+ .FirstOrDefault(a => a.GetName().Name == "Assembly-CSharp-Editor");
+
+ if (editorAssembly != null)
+ {
+ var checkerType = editorAssembly.GetType("BattleReportChecker");
+ if (checkerType != null)
+ {
+ var method = checkerType.GetMethod("AddBattlePackages",
+ System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
+ if (method != null)
+ {
+ method.Invoke(null, new object[] { guid, vPackList });
+ Debug.Log($"鎴樻枟鍖呮暟鎹凡娣诲姞鍒癇attleReportChecker锛屽寘鏁伴噺: {vPackList.Count}");
+ }
+ else
+ {
+ Debug.LogWarning("鏈壘鍒癇attleReportChecker.AddBattlePackages鏂规硶");
+ }
+ }
+ else
+ {
+ Debug.LogWarning("鏈壘鍒癇attleReportChecker绫诲瀷");
+ }
+ }
+ else
+ {
+ Debug.LogWarning("鏈壘鍒癆ssembly-CSharp-Editor绋嬪簭闆嗭紙鍙兘涓嶅湪Editor鐜锛�");
+ }
+ }
+ catch (Exception e)
+ {
+ Debug.LogWarning("璋冪敤BattleReportChecker澶辫触: " + e.Message);
+ }
#endif
}
diff --git a/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
index 3b55ad8..bedf178 100644
--- a/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
@@ -1,5 +1,15 @@
using UnityEngine;
using System.Collections.Generic;
+using System.Linq;
+
+#if UNITY_EDITOR
+public enum SkillCastEnum
+ {
+ MainSkill,
+ SubSkill,
+ }
+
+#endif
public class SkillRecordAction : RecordAction
{
@@ -8,7 +18,13 @@
#else
protected
#endif
+
+
SkillBase skillBase;
+
+#if UNITY_EDITOR
+ public SkillCastEnum skillCastEnum = SkillCastEnum.MainSkill;
+#endif
public HB427_tagSCUseSkill hB427_TagSCUseSkill;
@@ -77,6 +93,33 @@
{
skillBase.ForceFinished();
}
+
+#if UNITY_EDITOR
+ // 鏍囪鍖呮墽琛屽畬鎴�
+ if (tracePackUID != 0 && !string.IsNullOrEmpty(GetBattleFieldGuid()))
+ {
+ try
+ {
+ var editorAssembly = System.AppDomain.CurrentDomain.GetAssemblies()
+ .FirstOrDefault(a => a.GetName().Name == "Assembly-CSharp-Editor");
+ if (editorAssembly != null)
+ {
+ var checkerType = editorAssembly.GetType("BattleReportChecker");
+ if (checkerType != null)
+ {
+ var method = checkerType.GetMethod("MarkPackageExecuted",
+ System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
+ if (method != null)
+ {
+ method.Invoke(null, new object[] { GetBattleFieldGuid(), tracePackUID });
+ }
+ }
+ }
+ }
+ catch { }
+ }
+#endif
+
base.ForceFinish();
}
@@ -100,6 +143,32 @@
{
base.Run();
+#if UNITY_EDITOR
+ // 鏍囪鍖呭紑濮嬫墽琛�
+ if (tracePackUID != 0 && !string.IsNullOrEmpty(GetBattleFieldGuid()))
+ {
+ try
+ {
+ var editorAssembly = System.AppDomain.CurrentDomain.GetAssemblies()
+ .FirstOrDefault(a => a.GetName().Name == "Assembly-CSharp-Editor");
+ if (editorAssembly != null)
+ {
+ var checkerType = editorAssembly.GetType("BattleReportChecker");
+ if (checkerType != null)
+ {
+ var method = checkerType.GetMethod("MarkPackageExecuting",
+ System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
+ if (method != null)
+ {
+ method.Invoke(null, new object[] { GetBattleFieldGuid(), tracePackUID });
+ }
+ }
+ }
+ }
+ catch { }
+ }
+#endif
+
if (null == skillBase)
{
return;
diff --git a/Main/System/Battle/BattleField/RecordActions/SkillTestAction.cs b/Main/System/Battle/BattleField/RecordActions/SkillTestAction.cs
deleted file mode 100644
index 9edef71..0000000
--- a/Main/System/Battle/BattleField/RecordActions/SkillTestAction.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using UnityEngine;
-using System.Collections.Generic;
-using System;
-
-#if UNITY_EDITOR
-
-public class TestSkillAction : RecordAction
-{
-
- public HB427_tagSCUseSkill vNetData;
-
- public TestSkillAction(BattleField _battleField, int skillId, int hurtIndex)
- : base(RecordActionType.Skill, _battleField, null)
- {
- try
- {
- vNetData = new HB427_tagSCUseSkill();
-
- BattleObject battleObj = battleField.battleObjMgr.redCampList[0];
-
- vNetData.ObjID = (uint)battleObj.ObjID;
- vNetData.SkillID = (uint)skillId;
- vNetData.PMType = 0;
- vNetData.BattleType = 0;
- vNetData.CurHP = 100;
- vNetData.CurHPEx = 0;
- vNetData.HurtCount = 1;
- vNetData.HurtList = new HB427_tagSCUseSkill.tagSCUseSkillHurt[vNetData.HurtCount];
-
- // 浼ゅ鐨勫璞�
- BattleObject hurtObj = battleField.battleObjMgr.GetBattleObjectByIndex(BattleCamp.Blue, hurtIndex);
- var hurt = new HB427_tagSCUseSkill.tagSCUseSkillHurt();
- hurt.ObjID = (uint)hurtObj.ObjID;
- hurt.AttackTypes = 1; // 鏅�氫激瀹�
- hurt.HurtHP = 2; // 浼ゅ鍊�
- hurt.HurtHPEx = 0;
- hurt.CurHP = 100;
- hurt.CurHPEx = 0;
- hurt.SuckHP = 0;
- hurt.BounceHP = 0;
-
- vNetData.HurtList[0] = hurt;
- }
- catch (Exception err)
- {
- BattleDebug.LogError("Error occurred while creating TestSkillAction: " + err.Message);
- }
-
-
- }
-
- public override bool IsFinished()
- {
- return isFinish;
- }
-
- public override void Run()
- {
- base.Run();
-
- if (!isRunOnce)
- {
- isRunOnce = true;
- CustomHB426CombinePack pack = CustomHB426CombinePack.CreateCustomPack(string.Empty, vNetData);
- battleField.recordPlayer.PlayRecord(pack.CreateSkillAction());
- isFinish = true;
- return;
- }
- }
-
-}
-
-#endif
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/RecordActions/SkillTestAction.cs.meta b/Main/System/Battle/BattleField/RecordActions/SkillTestAction.cs.meta
deleted file mode 100644
index ea4597c..0000000
--- a/Main/System/Battle/BattleField/RecordActions/SkillTestAction.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: bae3c8afb50af6f48977e93e0994dee5
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Main/System/Battle/BattleField/RecordActions/TestAction.cs b/Main/System/Battle/BattleField/RecordActions/TestAction.cs
deleted file mode 100644
index 24a6115..0000000
--- a/Main/System/Battle/BattleField/RecordActions/TestAction.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using UnityEngine;
-using System.Collections.Generic;
-using System;
-
-#if UNITY_EDITOR
-
-public class TestAction : RecordAction
-{
- protected int targetIndex;
- protected int selfIndex;
- protected int distance = 100;
- protected float duration = 2f;
-
- public TestAction(BattleField _battleField, int _targetIndex, int _selfIndex, int _distance, float _duration)
- : base(RecordActionType.Death, _battleField, null)
- {
- targetIndex = _targetIndex;
- selfIndex = _selfIndex;
- distance = _distance;
- duration = _duration;
- }
-
- public override bool IsFinished()
- {
- return isFinish;
- }
-
- public override void Run()
- {
- base.Run();
-
- if (!isRunOnce)
- {
- isRunOnce = true;
-
- RectTransform target = battleField.GetTeamNode(BattleCamp.Blue, targetIndex);
- MoveToTarget(target, new Vector2(distance, 0), duration, () =>
- {
- BattleDebug.LogError(" reach to the target ");
- isFinish = true;
- });
-
- return;
- }
- }
-
- protected void MoveToTarget(RectTransform target, Vector2 offset, float duration, Action onComplete = null)
- {
- try
- {
- BattleObject caster = battleField.battleObjMgr.GetBattleObjectByIndex(BattleCamp.Red, selfIndex);
- BattleDebug.LogError("Move to target , target is " + target.name);
- caster.motionBase.PlayAnimation(MotionName.run, true);
- var tweener = BattleUtility.MoveToTarget(caster.heroRectTrans, target, offset, () =>
- {
- caster.motionBase.PlayAnimation(MotionName.idle, true);
- onComplete?.Invoke();
- });
- battleField.battleTweenMgr.OnPlayTween(tweener);
- }
- catch (Exception e)
- {
- BattleDebug.LogError("Error in MoveToTarget: " + e.Message);
- isFinish = true;
- }
- }
-}
-
-#endif
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/RecordActions/TestAction.cs.meta b/Main/System/Battle/BattleField/RecordActions/TestAction.cs.meta
deleted file mode 100644
index dadf6c8..0000000
--- a/Main/System/Battle/BattleField/RecordActions/TestAction.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: c718ef62f36d7b240980acefa56958fd
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Main/System/Battle/Motion/MotionBase.cs b/Main/System/Battle/Motion/MotionBase.cs
index 336772a..f7ca6eb 100644
--- a/Main/System/Battle/Motion/MotionBase.cs
+++ b/Main/System/Battle/Motion/MotionBase.cs
@@ -16,7 +16,7 @@
private Dictionary<Spine.TrackEntry, Action> trackEntryCallbacks = new Dictionary<Spine.TrackEntry, Action>();
- private Dictionary<int, SkillBase> skillTrackDict = new Dictionary<int, SkillBase>();
+ // private Dictionary<int, SkillBase> skillTrackDict = new Dictionary<int, SkillBase>();
public Action OnAttackAnimationComplete;
public Action OnHitAnimationComplete;
private List<Action> runningActions = new List<Action>();
@@ -91,7 +91,7 @@
currentTrack = null;
playingSkill = false;
playingSkillWithAnim = false;
- skillTrackDict.Clear();
+ // skillTrackDict.Clear();
}
public virtual Spine.TrackEntry PlayAnimation(MotionName motionName, bool loop, Action onComplete = null)
@@ -227,7 +227,7 @@
if (hasAnim)
{
// 妫�鏌ヨ建閬撴槸鍚﹀凡琚崰鐢紙淇锛氬師鏉ユ鏌� null != skillTrack 姘歌繙涓� false锛�
- if (activeSkillTracks.ContainsKey(trackIndex) || skillTrackDict.ContainsKey(trackIndex))
+ if (activeSkillTracks.ContainsKey(trackIndex) /*|| skillTrackDict.ContainsKey(trackIndex)*/)
{
//绛夊緟涓婁竴鎶�鑳藉姩鐢荤粨鏉� 鏆傛椂澶勭悊鍔炴硶
UniTaskExtension.DelayFrames((GameObject)null, 1, () =>
@@ -254,13 +254,13 @@
return null;
}
- if (skillTrackDict.ContainsKey(trackIndex))
- {
- skillBase.ForceFinished();
- skillTrackDict.Remove(trackIndex);
- }
+ // if (skillTrackDict.ContainsKey(trackIndex))
+ // {
+ // skillBase.ForceFinished();
+ // skillTrackDict.Remove(trackIndex);
+ // }
- skillTrackDict[trackIndex] = skillBase;
+ // skillTrackDict[trackIndex] = skillBase;
// 鍙湁涓绘妧鑳芥墠鏇存柊 currentTrack
if (!isSubSkill)
@@ -290,7 +290,7 @@
{
if (skillBase.IsFinished())
{
- skillTrackDict.Remove(trackIndex);
+ // skillTrackDict.Remove(trackIndex);
// 娓呯悊骞堕��鍑猴紙淇濊瘉鐘舵�佷竴鑷达級
if (skillTrack != null && activeSkillTracks.ContainsKey(trackIndex))
{
@@ -344,8 +344,8 @@
// 妫�鏌ュ綋鍓嶈建閬撴槸鍚﹁鏂版妧鑳借鐩�
if (!activeSkillTracks.ContainsKey(trackIndex) || activeSkillTracks[trackIndex] != skillTrack)
{
- skillTrackDict[trackIndex].ForceFinished();
- skillTrackDict.Remove(trackIndex);
+ // skillTrackDict[trackIndex].ForceFinished();
+ // skillTrackDict.Remove(trackIndex);
Debug.LogError("鎶�鑳藉姩鐢昏鎵撴柇锛屽己鍒剁粨鏉� " + skillConfig.SkillID);
skillBase.ForceFinished();
@@ -486,7 +486,7 @@
playingSkill = false;
}
- skillTrackDict.Remove(trackIndex);
+ // skillTrackDict.Remove(trackIndex);
RemoveAction(frameHandler);
onComplete?.Invoke();
@@ -644,11 +644,7 @@
activeSkillTracks.Clear();
// 寮哄埗缁撴潫鎵�鏈夋鍦ㄦ墽琛岀殑鎶�鑳�
- foreach (var kv in skillTrackDict)
- {
- kv.Value?.ForceFinished();
- }
- skillTrackDict.Clear();
+ // skillTrackDict.Clear();
// 閲嶇疆瀛愭妧鑳借建閬撴睜
if (availableSubTracks == null)
@@ -682,12 +678,8 @@
activeSkillTracks.Clear();
- // 寮哄埗缁撴潫鎵�鏈夋鍦ㄦ墽琛岀殑鎶�鑳斤紙澶嶆椿鏃堕渶瑕佹竻鐞嗘墍鏈夋妧鑳界姸鎬侊級
- foreach (var kv in skillTrackDict)
- {
- kv.Value?.ForceFinished();
- }
- skillTrackDict.Clear();
+ // 澶嶆椿 涓嶈兘娓呯悊姝e湪鎵ц鐨勬妧鑳借建閬� 鏈夊彲鑳芥槸澶嶆椿鑷繁
+ // skillTrackDict.Clear();
// 3. 閲嶇疆瀛愭妧鑳借建閬撴睜
if (availableSubTracks == null)
diff --git a/Main/System/Battle/RecordPlayer/RecordAction.cs b/Main/System/Battle/RecordPlayer/RecordAction.cs
index 6e2a5fe..01d5cc9 100644
--- a/Main/System/Battle/RecordPlayer/RecordAction.cs
+++ b/Main/System/Battle/RecordPlayer/RecordAction.cs
@@ -8,6 +8,8 @@
public int actionID;
+ public ulong tracePackUID = 0;
+
private static int autoincreser = 0;
protected BattleField battleField;
--
Gitblit v1.8.0