From ed9bf64c03bf5fee5e115645de5a975baaa9041d Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 09 一月 2026 11:04:53 +0800
Subject: [PATCH] 125 战斗 修改死亡表现 带动作的子技能同时触发导致的卡死

---
 Main/System/Battle/RecordPlayer/RecordPlayer.cs |   69 ++++++++++++++++++++++++++++++++--
 1 files changed, 64 insertions(+), 5 deletions(-)

diff --git a/Main/System/Battle/RecordPlayer/RecordPlayer.cs b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
index 2994bea..f73d78d 100644
--- a/Main/System/Battle/RecordPlayer/RecordPlayer.cs
+++ b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
@@ -43,7 +43,7 @@
     public void PlayRecord(RecordAction recordAction)
     {
         if (recordAction == null) return;
-        BattleDebug.LogError("Enqueue record action " + recordAction.GetType());
+        // Debug.LogError("Enqueue record action " + recordAction.GetType() + " to queue");
         if (isForceFinish || stepForcefinish)
         {
             recordAction.ForceFinish();
@@ -69,7 +69,7 @@
             return;
         }
 
-        BattleDebug.LogError("Insert record action " + recordAction.GetType());
+        // Debug.LogError("Insert record action " + recordAction.GetType() + " at front of queue");
         if (currentRecordAction != null)
         {
             Queue<RecordAction> tempQueue = new Queue<RecordAction>();
@@ -97,13 +97,39 @@
         immediatelyActionList.Add(recordAction);
     }
 
+    //  澧炲己鐗堟湰锛氭敮鎸佺埗瀛愬叧绯诲拰WaitingPlay鏍囪
+    public void ImmediatelyPlay(RecordAction recordAction, RecordAction parentAction, bool isWaitingPlay)
+    {
+        if (recordAction == null) return;
+        if (isForceFinish || stepForcefinish)
+        {
+            recordAction.ForceFinish();
+            return;
+        }
+
+        // Debug.LogError("insert recordAction ImmediatelyPlay: " + recordAction.GetType().Name + " parentAction: " + (parentAction != null ? parentAction.GetType().Name : "null") + " isWaitingPlay: " + isWaitingPlay);
+        
+        //  璁剧疆鐖跺瓙鍏崇郴
+        if (parentAction != null)
+        {
+            recordAction.SetParentAction(parentAction);
+            parentAction.AddChildAction(recordAction);
+        }
+        
+        //  璁剧疆WaitingPlay鏍囪
+        recordAction.SetWaitingPlay(isWaitingPlay);
+        
+        immediatelyActionList.Add(recordAction);
+    }
+
     protected void ImmediatelyPlayRun()
     {
         if (immediatelyActionList.Count > 0)
         {
             List<int> removeIndexList = new List<int>();
 
-            for (int i = immediatelyActionList.Count - 1; i >= 0; i--)
+            //  鍏抽敭淇锛氫粠鍓嶅線鍚庨亶鍘嗭紝纭繚鎸夊姞鍏ラ『搴忔墽琛�
+            for (int i = 0; i < immediatelyActionList.Count; i++)
             {
                 var action = immediatelyActionList[i];
                 if (action == null)
@@ -111,6 +137,38 @@
                     removeIndexList.Add(i);
                     continue;
                 }
+                
+                //  妫�鏌ユ槸鍚﹀彲浠ュ紑濮嬫墽琛岋紙WaitingPlay鏉′欢妫�鏌ワ級
+                if (!action.CanStartExecution())
+                {
+                    continue;
+                }
+                
+                //  妫�鏌ュ悓绾х殑鍓嶇疆鍏勫紵鑺傜偣锛氬鏋滄湁鐩稿悓鐖惰妭鐐逛笖绱㈠紩鏇村皬鐨勮妭鐐硅繕鍦ㄦ墽琛岋紝鍒欑瓑寰�
+                bool shouldWaitForSibling = false;
+                if (action.isWaitingPlay && action.parentAction != null)
+                {
+                    for (int j = 0; j < i; j++)
+                    {
+                        var prevAction = immediatelyActionList[j];
+                        if (prevAction != null && prevAction.parentAction == action.parentAction)
+                        {
+                            //  鎵惧埌鍚岀骇鍓嶇疆鑺傜偣锛屽鏋滃畠杩樺湪鎵ц涓紝鍒欏綋鍓嶈妭鐐归渶瑕佺瓑寰�
+                            if (!prevAction.IsFinished())
+                            {
+                                shouldWaitForSibling = true;
+                                // BattleDebug.LogError($"RecordPlayer: {action.GetType().Name} 绛夊緟鍚岀骇鍓嶇疆鑺傜偣 {prevAction.GetType().Name} 瀹屾垚");
+                                break;
+                            }
+                        }
+                    }
+                }
+                
+                if (shouldWaitForSibling)
+                {
+                    continue;
+                }
+                
                 if (!action.IsFinished())
                 {
                     action.Run();
@@ -120,6 +178,7 @@
                 removeIndexList.Add(i);
             }
 
+            //  浠庡悗寰�鍓嶅垹闄わ紝纭繚绱㈠紩涓嶄細鍥犱负鍒犻櫎鑰岄敊浣�
             for (int i = removeIndexList.Count - 1; i >= 0; i--)
             {
                 int index = removeIndexList[i];
@@ -166,7 +225,7 @@
         if (currentRecordAction != null && currentRecordAction.IsFinished())
         {
             var guid = currentRecordAction.GetBattleFieldGuid();
-            BattleDebug.LogError("record action " + currentRecordAction.GetType() + " play finished");
+            // BattleDebug.LogError("record action " + currentRecordAction.GetType() + " play finished");
             currentRecordAction = null;
             isWaitingNextAction = true;
             waitTimer = 0f;
@@ -179,7 +238,7 @@
             if (recordActionQueue.Count > 0)
             {
                 currentRecordAction = recordActionQueue.Dequeue();
-                BattleDebug.LogError("play record action " + currentRecordAction.GetType());
+                // BattleDebug.LogError("play record action " + currentRecordAction.GetType());
             }
         }
     }

--
Gitblit v1.8.0