From 7935e509ef7a17cfcaceb81944745b19f8b7087c Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 22 五月 2026 16:15:36 +0800
Subject: [PATCH] 花鬘自身复活问题修复
---
Main/System/Battle/RecordPlayer/RecordPlayer.cs | 80 +++++++++++++++++++++++++++++++++++++++
Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs | 8 ++++
Main/System/Battle/Motion/MotionBase.cs | 2
Main/System/Battle/Skill/RebornSkill.cs | 3 +
4 files changed, 90 insertions(+), 3 deletions(-)
diff --git a/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
index fe4793f..5ff2418 100644
--- a/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
@@ -46,6 +46,8 @@
if (!isRunOnce)
{
isRunOnce = true;
+ // 澶嶆椿鍔ㄧ敾寮�濮嬶紝閿佷綇 recordPlayer锛宱wner=this 鍏佽鑷韩缁х画鎵ц锛屽叾浣欑瓑寰�
+ battleField.recordPlayer.SetExclusiveLock(true, this);
PlayRebornEffect();
}
}
@@ -63,6 +65,7 @@
{
actionCallback?.Invoke();
actionCallback = null;
+ battleField.recordPlayer.SetExclusiveLock(false, null);
isActionCompleted = true;
isFinish = true;
return;
@@ -100,6 +103,8 @@
}
actionCallback?.Invoke();
actionCallback = null;
+ // 澶嶆椿娴佺▼缁撴潫锛岃В閿�
+ battleField.recordPlayer.SetExclusiveLock(false, null);
isActionCompleted = true; // 鏍囪鍔ㄤ綔瀹屾垚
isFinish = true;
}));
@@ -117,6 +122,9 @@
battleField.battleTweenMgr.OnKillTween(tweenSeq);
+ // 寮哄埗缁撴潫鏃朵篃瑕佽В閿�
+ battleField.recordPlayer.SetExclusiveLock(false, null);
+
foreach (var bo in rebornObjs)
{
var battleObj = bo;
diff --git a/Main/System/Battle/Motion/MotionBase.cs b/Main/System/Battle/Motion/MotionBase.cs
index 12d5ef5..1a1c31d 100644
--- a/Main/System/Battle/Motion/MotionBase.cs
+++ b/Main/System/Battle/Motion/MotionBase.cs
@@ -789,7 +789,7 @@
if (Launch.Instance != null && Launch.Instance.isOpenBattleDebug)
{
string owner = skeletonAnim != null && skeletonAnim.gameObject != null ? skeletonAnim.gameObject.name : "(no-skel)";
- BattleDebug.LogError($"[MotionBase.ResetForReborn owner={owner} hash={GetHashCode()}] reviveSelf={reviveSelf} 璋冪敤鏍堬細\n{UnityEngine.StackTraceUtility.ExtractStackTrace()}");
+ BattleDebug.LogError($"[MotionBase.ResetForReborn owner={owner} hash={GetHashCode()}] reviveSelf={reviveSelf} 璋冪敤鏍堬細\n{UnityEngine.StackTraceUtility.ExtractStackTrace()}");
}
#endif
// 璺� HaveRest 鍚岀悊锛氬厛寮哄埗缁撴潫鎵�鏈夋鍦ㄨ繍琛岀殑 skillBase锛�
diff --git a/Main/System/Battle/RecordPlayer/RecordPlayer.cs b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
index 52440ff..b7eb2a5 100644
--- a/Main/System/Battle/RecordPlayer/RecordPlayer.cs
+++ b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
@@ -19,6 +19,27 @@
private bool isForceFinish = false;
+ // 绔嬪嵆鎾斁骞舵帴绠¢槦鍒楋細姝e湪骞跺彂杩愯銆乧urrent缁撴潫鍚庤嫢灏氭湭瀹屾垚鍒欐彁鍗囦负currentRecordAction
+ private RecordAction pendingTakeoverAction = null;
+
+ // 澶嶆椿鐙崰閿侊細閿佷綇鏈熼棿鍙湁 owner 鍙互鎵ц锛屽叾浠� RecordAction 淇濈暀骞剁瓑寰呰В閿�
+ private bool isExclusiveLocked = false;
+ // 鎸佹湁鐙崰閿佺殑 action锛堝厑璁稿畠鍦ㄩ攣浣忔湡闂寸户缁墽琛岋級
+ private RecordAction exclusiveLockOwner = null;
+
+ /// <summary>
+ /// 璁剧疆鐙崰閿併��<br/>
+ /// locked=true 鏃讹細鏆傚仠 owner 涔嬪鐨� RecordAction 璋冨害锛屽凡鏈夐槦鍒楀拰鏂板叆闃� action 鍧囦繚鐣欑瓑寰呫��
+ /// locked=false 鏃惰В閿侊紝鎭㈠姝e父璋冨害銆�
+ /// </summary>
+ public void SetExclusiveLock(bool locked, RecordAction owner = null)
+ {
+ isExclusiveLocked = locked;
+ exclusiveLockOwner = locked ? owner : null;
+ }
+
+ public bool IsExclusiveLocked => isExclusiveLocked;
+
public bool IsForceFinish
{
get { return isForceFinish; }
@@ -169,6 +190,27 @@
}
}
+ /// <summary>
+ /// 绔嬪嵆寮�濮嬪苟鍙戞挱鏀� recordAction锛屽悓鏃跺皢鍏惰涓恒�岄槦鍒楁帴绠¤�呫�嶏細
+ /// 褰� currentRecordAction 鎾斁瀹屾瘯鏃讹紝鑻ヨ action 灏氭湭缁撴潫锛�
+ /// 鍒欏皢鍏朵粠 immediatelyActionList 鎻愬崌涓烘柊鐨� currentRecordAction锛�
+ /// 闃绘闃熷垪缁х画鎺ㄨ繘锛岀洿鍒板畠涔熷畬鎴愪负姝€��
+ /// </summary>
+ public void ImmediatelyPlayThenBlockQueue(RecordAction recordAction)
+ {
+ if (recordAction == null) return;
+ recordAction.actionOwner = this;
+ if (isForceFinish || stepForcefinish)
+ {
+ recordAction.ForceFinish();
+ return;
+ }
+ // 绔嬪嵆鍔犲叆骞跺彂鍒楄〃锛屽紑濮嬫墽琛�
+ immediatelyActionList.Add(recordAction);
+ // 鏍囪涓哄緟鎺ョ鑰咃紝current缁撴潫鍚庣敱 Run() 灏嗗叾鎻愬崌
+ pendingTakeoverAction = recordAction;
+ }
+
public void InsertRecord(RecordAction recordAction, int position = 0)
{
if (recordAction == null) return;
@@ -298,6 +340,12 @@
removeIndexList.Add(i);
continue;
}
+
+ // 鐙崰閿佹湡闂达紝闈� owner 鐨� immediate action 鍙瓑寰咃紝涓嶆墽琛屼篃涓嶇Щ闄�
+ if (isExclusiveLocked && action != exclusiveLockOwner)
+ {
+ continue;
+ }
// 妫�鏌ユ槸鍚﹀彲浠ュ紑濮嬫墽琛岋紙WaitingPlay鏉′欢妫�鏌ワ級
if (!action.CanStartExecution())
@@ -370,6 +418,12 @@
{
ImmediatelyPlayRun();
+ // 鐙崰閿佹湡闂达紝涓荤嚎 current/queue 鏆傚仠锛屽彧鍏佽 owner 缁х画鎵ц
+ if (isExclusiveLocked && (exclusiveLockOwner == null || currentRecordAction != exclusiveLockOwner))
+ {
+ return;
+ }
+
// 绛夊緟涓嬩竴涓猘ction
if (isWaitingNextAction)
{
@@ -387,7 +441,7 @@
if (currentRecordAction == null)
{
- if (recordActionQueue.Count <= 0)
+ if (recordActionQueue.Count <= 0 && pendingTakeoverAction == null)
{
return;
}
@@ -419,6 +473,21 @@
if (currentRecordAction == null)
{
+ // 妫�鏌ユ槸鍚︽湁寰呮帴绠$殑 action
+ if (pendingTakeoverAction != null)
+ {
+ if (!pendingTakeoverAction.IsFinished())
+ {
+ // 鎻愬崌涓� currentRecordAction锛岄樆濉為槦鍒楁帹杩�
+ immediatelyActionList.Remove(pendingTakeoverAction);
+ currentRecordAction = pendingTakeoverAction;
+ pendingTakeoverAction = null;
+ return;
+ }
+ // 宸茬粡瀹屾垚锛岀洿鎺ユ竻闄わ紝涓嶉樆濉�
+ pendingTakeoverAction = null;
+ }
+
if (recordActionQueue.Count > 0)
{
currentRecordAction = recordActionQueue.Dequeue();
@@ -457,6 +526,9 @@
{
currentRecordAction?.ForceFinish();
currentRecordAction = null;
+ pendingTakeoverAction = null;
+ isExclusiveLocked = false;
+ exclusiveLockOwner = null;
recordActionQueue.Clear();
immediatelyActionList.Clear();
}
@@ -469,6 +541,9 @@
public void ForceFinish()
{
isForceFinish = true;
+ isExclusiveLocked = false;
+ exclusiveLockOwner = null;
+ pendingTakeoverAction = null;
for (int i = immediatelyActionList.Count - 1; i >= 0; i--)
{
var action = immediatelyActionList[i];
@@ -496,9 +571,12 @@
currentRecordAction.ForceFinish();
}
currentRecordAction = null;
+ pendingTakeoverAction = null;
recordActionQueue.Clear();
immediatelyActionList.Clear();
isForceFinish = false;
+ isExclusiveLocked = false;
+ exclusiveLockOwner = null;
stepForcefinish = false;
}
diff --git a/Main/System/Battle/Skill/RebornSkill.cs b/Main/System/Battle/Skill/RebornSkill.cs
index df6fb7b..09b3169 100644
--- a/Main/System/Battle/Skill/RebornSkill.cs
+++ b/Main/System/Battle/Skill/RebornSkill.cs
@@ -54,7 +54,8 @@
});
- battleField.recordPlayer.ImmediatelyPlay(recordAction);
+ battleField.recordPlayer.SetExclusiveLock(true, recordAction);
+ battleField.recordPlayer.ImmediatelyPlayThenBlockQueue(recordAction);
bool vValue = true;
--
Gitblit v1.8.0