feat: rewrite 3D step undo using an exact ActionHistory stack
This commit is contained in:
@@ -69,6 +69,7 @@ public class PingClickHandler : MonoBehaviour
|
||||
{
|
||||
_modelShown = true;
|
||||
_isBlinking = false;
|
||||
ActionHistory.Push(ActionHistory.ActionType.PingFirst, this);
|
||||
StopAllCoroutines();
|
||||
if (_modelRenderer != null) _modelRenderer.enabled = true;
|
||||
foreach (var r in GetComponentsInChildren<Renderer>(true)) r.enabled = true;
|
||||
@@ -92,7 +93,8 @@ public class PingClickHandler : MonoBehaviour
|
||||
else
|
||||
{
|
||||
if (chanraoObject != null) { chanraoObject.SetActive(true); Debug.Log($"[PingClick] {name} → {chanraoObject.name}"); }
|
||||
gameObject.SetActive(false);
|
||||
HideSelf();
|
||||
ActionHistory.Push(ActionHistory.ActionType.PingSecond, this);
|
||||
var sm = FindObjectOfType<StepManager>();
|
||||
if (sm != null) sm.RecordPingStep(pingIndex, true);
|
||||
|
||||
@@ -123,15 +125,26 @@ public class PingClickHandler : MonoBehaviour
|
||||
public void ReEnableBorder() { _isBlinking = true; if (_outlineMesh != null) { _outlineMesh.enabled = true; StopAllCoroutines(); StartCoroutine(BlinkOutline()); } }
|
||||
public void UndoSecondClick()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
ShowSelf();
|
||||
_modelShown = true;
|
||||
_isBlinking = false;
|
||||
if (_modelRenderer != null) _modelRenderer.enabled = true;
|
||||
foreach (var r in GetComponentsInChildren<Renderer>(true)) r.enabled = true;
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = false;
|
||||
}
|
||||
public void UndoShow() { HideSelf(); }
|
||||
|
||||
private void HideSelf()
|
||||
{
|
||||
foreach (var r in GetComponentsInChildren<Renderer>(true)) r.enabled = false;
|
||||
var col = GetComponent<Collider>(); if (col != null) col.enabled = false;
|
||||
_isBlinking = false;
|
||||
StopAllCoroutines();
|
||||
}
|
||||
public void UndoShow() { gameObject.SetActive(false); }
|
||||
|
||||
private void ShowSelf()
|
||||
{
|
||||
foreach (var r in GetComponentsInChildren<Renderer>(true)) r.enabled = true;
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = false;
|
||||
var col = GetComponent<Collider>(); if (col != null) col.enabled = true;
|
||||
}
|
||||
|
||||
public void ResetState()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user