diff --git a/Assets/Scripts/Core/UndoManager.cs b/Assets/Scripts/Core/UndoManager.cs index b1e8f53..8be0adc 100644 --- a/Assets/Scripts/Core/UndoManager.cs +++ b/Assets/Scripts/Core/UndoManager.cs @@ -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(); - if (sm != null) sm.SetPingStepIndex(8); // 退回到 4 个底模已确认的状态 (Ping 阶段的第一半结束) + if (sm != null) sm.SetPingStepIndex(0); return true; }