Revert ping undo logic to reset the entire ping sequence back to 004

This commit is contained in:
yangbear
2026-07-10 01:17:51 +08:00
parent f8006c4d22
commit a90eb4222a
+14 -6
View File
@@ -32,10 +32,10 @@ public static class ActionHistory
var item = History.Pop();
Debug.Log($"[ActionHistory] Undo {item.Type} handler={(item.Handler != null ? item.Handler.name : "null")}, remaining={History.Count}");
if (item.Type == ActionType.PingSecond)
if (item.Type == ActionType.PingFirst || item.Type == ActionType.PingSecond)
{
// 如果在包扎(第二阶段),则重置所有的包扎纱布,退回到所有骨折点发光的状态
while (History.Count > 0 && History.Peek().Type == ActionType.PingSecond)
// 如果遇到任何 Ping 的动作,就代表用户想重置整个包扎步骤
while (History.Count > 0 && (History.Peek().Type == ActionType.PingFirst || History.Peek().Type == ActionType.PingSecond))
{
History.Pop();
}
@@ -44,12 +44,20 @@ public static class ActionHistory
foreach (var p in allPings)
{
if (p.chanraoObject != null) p.chanraoObject.SetActive(false);
p.gameObject.SetActive(true);
p.ReEnableBorder();
if (p.pingIndex == 0)
{
p.gameObject.SetActive(true);
p.ResetState();
}
else
{
p.UndoShow();
}
}
var sm = Object.FindObjectOfType<StepManager>();
if (sm != null) sm.SetPingStepIndex(8); // 退回到 4 个底模已确认的状态 (Ping 阶段的第一半结束)
if (sm != null) sm.SetPingStepIndex(0);
return true;
}