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/RecordAction.cs | 121 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 120 insertions(+), 1 deletions(-)
diff --git a/Main/System/Battle/RecordPlayer/RecordAction.cs b/Main/System/Battle/RecordPlayer/RecordAction.cs
index bc5ee39..76bdc10 100644
--- a/Main/System/Battle/RecordPlayer/RecordAction.cs
+++ b/Main/System/Battle/RecordPlayer/RecordAction.cs
@@ -14,6 +14,19 @@
protected bool isRunOnce = false;
+ // ===== 鐖跺瓙鍏崇郴鍜岀瓑寰呮満鍒� =====
+ // 鐖禦ecordAction寮曠敤锛堝鏋滄槸閫氳繃鍏朵粬RecordAction鍐呴儴瑙﹀彂鐨勶級
+ public RecordAction parentAction;
+
+ // 瀛怰ecordAction鍒楄〃锛堟RecordAction鍐呴儴瑙﹀彂鐨勫叾浠朢ecordAction锛�
+ protected List<RecordAction> childActionList = new List<RecordAction>();
+
+ // 鏄惁鏄疻aitingPlay妯″紡锛堥渶瑕佺瓑寰呯埗鑺傜偣鍔ㄤ綔瀹屾垚锛�
+ public bool isWaitingPlay = false;
+
+ // 鑷韩鍔ㄤ綔鏄惁瀹屾垚锛堜笉鍖呮嫭瀛愯妭鐐圭殑瀹屾垚鐘舵�侊級
+ protected bool isActionCompleted = false;
+
public RecordAction(RecordActionType _actionType, BattleField _battleField, BattleObject _battleObj)
{
actionType = _actionType;
@@ -21,11 +34,105 @@
battleObject = _battleObj;
}
+ public virtual void Played()
+ {
+
+ }
+
public RecordActionType actionType;
+ // 娣诲姞瀛怰ecordAction
+ public virtual void AddChildAction(RecordAction child)
+ {
+ if (child == null) return;
+
+ // 闃叉閲嶅娣诲姞
+ if (childActionList.Contains(child)) return;
+
+ // 闃叉寰幆渚濊禆
+ if (child == this)
+ {
+ BattleDebug.LogError("RecordAction.AddChildAction: 涓嶈兘灏嗚嚜宸辨坊鍔犱负瀛愯妭鐐�");
+ return;
+ }
+
+ childActionList.Add(child);
+ BattleDebug.LogError($"RecordAction.AddChildAction: {this.GetType().Name} 娣诲姞瀛愯妭鐐� {child.GetType().Name}");
+ }
+
+ // 璁剧疆鐖禦ecordAction
+ public virtual void SetParentAction(RecordAction parent)
+ {
+ parentAction = parent;
+ if (parent != null)
+ {
+ BattleDebug.LogError($"RecordAction.SetParentAction: {this.GetType().Name} 鐨勭埗鑺傜偣璁剧疆涓� {parent.GetType().Name}");
+ }
+ }
+
+ // 璁剧疆WaitingPlay鏍囪
+ public virtual void SetWaitingPlay(bool waiting)
+ {
+ isWaitingPlay = waiting;
+ BattleDebug.LogError($"RecordAction.SetWaitingPlay: {this.GetType().Name} WaitingPlay={waiting}");
+ }
+
+ // 妫�鏌ヨ嚜韬姩浣滄槸鍚﹀畬鎴愶紙涓嶅寘鎷瓙鑺傜偣锛�
+ // 瀛愮被搴旇閲嶅啓姝ゆ柟娉曟潵瀹炵幇鑷繁鐨勫姩浣滃畬鎴愬垽鏂�
+ public virtual bool IsActionCompleted()
+ {
+ return isActionCompleted;
+ }
+
+ // 妫�鏌ユ槸鍚﹀彲浠ュ紑濮嬫墽琛岋紙WaitingPlay鏉′欢妫�鏌ワ級
+ public virtual bool CanStartExecution()
+ {
+ // 濡傛灉涓嶆槸WaitingPlay妯″紡锛岀洿鎺ュ彲浠ユ墽琛�
+ if (!isWaitingPlay)
+ {
+ return true;
+ }
+
+ // 濡傛灉娌℃湁鐖惰妭鐐癸紝涔熷彲浠ユ墽琛�
+ if (parentAction == null)
+ {
+ return true;
+ }
+
+ // WaitingPlay妯″紡涓嬶紝闇�瑕佺瓑寰呯洿鎺ョ埗鑺傜偣鐨勫姩浣滃畬鎴愶紙涓嶇鐖惰妭鐐规槸鍚aitingPlay锛�
+ if (!parentAction.IsActionCompleted())
+ {
+ BattleDebug.LogError($"RecordAction.CanStartExecution: {this.GetType().Name} 绛夊緟鐖惰妭鐐� {parentAction.GetType().Name} 鍔ㄤ綔瀹屾垚");
+ return false;
+ }
+
+ return true;
+ }
+
+ public virtual bool IsNeedWaiting()
+ {
+ return false;
+ }
+
+ // 妫�鏌ユ槸鍚﹀畬鍏ㄥ畬鎴愶紙鍖呮嫭鎵�鏈夊瓙鑺傜偣锛�
public virtual bool IsFinished()
{
- return isFinish;
+ // 棣栧厛鑷韩鍔ㄤ綔蹇呴』瀹屾垚
+ if (!isActionCompleted && !isFinish)
+ {
+ return false;
+ }
+
+ // 妫�鏌ユ墍鏈夊瓙鑺傜偣鏄惁瀹屾垚
+ foreach (var child in childActionList)
+ {
+ if (!child.IsFinished())
+ {
+ return false;
+ }
+ }
+
+ return true;
}
public virtual void Run()
@@ -36,6 +143,18 @@
public virtual void ForceFinish()
{
isFinish = true;
+ isActionCompleted = true;
+
+ // 寮哄埗缁撴潫鎵�鏈夊瓙鑺傜偣
+ for (int i = childActionList.Count - 1; i >= 0; i--)
+ {
+ var child = childActionList[i];
+ child?.ForceFinish();
+ }
+
+ // 娓呯悊鐖跺瓙寮曠敤锛岄槻姝㈠唴瀛樻硠婕�
+ childActionList.Clear();
+ parentAction = null;
}
public virtual string GetBattleFieldGuid()
--
Gitblit v1.8.0