feat: rewrite 3D step undo using an exact ActionHistory stack
This commit is contained in:
@@ -64,6 +64,7 @@ public class ChanraoTuibuHandler : MonoBehaviour
|
||||
public void PerformClick()
|
||||
{
|
||||
Debug.Log($"[ChanraoTuibu] {name} 被点击");
|
||||
ActionHistory.Push(ActionHistory.ActionType.ChanraoTuibu, this);
|
||||
_isBlinking = false;
|
||||
StopAllCoroutines();
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = false;
|
||||
@@ -88,10 +89,12 @@ public class ChanraoTuibuHandler : MonoBehaviour
|
||||
|
||||
public void ResetState()
|
||||
{
|
||||
_isBlinking = true;
|
||||
var mr = GetComponent<MeshRenderer>(); if (mr != null) mr.enabled = false;
|
||||
var smr = GetComponent<SkinnedMeshRenderer>(); if (smr != null) smr.enabled = false;
|
||||
foreach (var r in GetComponentsInChildren<Renderer>(true)) { if (_outlineMesh != null && r == _outlineMesh) continue; r.enabled = false; }
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = true;
|
||||
if (nextObject != null) nextObject.SetActive(false);
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(BlinkOutline());
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -79,6 +79,7 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
if (_clicked) return;
|
||||
_clicked = true;
|
||||
Debug.Log("[ShoseClick] ★ 被点击 ★");
|
||||
ActionHistory.Push(ActionHistory.ActionType.Shose, this);
|
||||
StopAllCoroutines();
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = false;
|
||||
if (targetPoint != null) { transform.position = targetPoint.position; transform.rotation = targetPoint.rotation; }
|
||||
@@ -157,6 +158,8 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
transform.rotation = _initialRotation;
|
||||
}
|
||||
|
||||
if (nextObject != null) nextObject.SetActive(false);
|
||||
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(BlinkOutline());
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ public class TouchPositionHandler : MonoBehaviour
|
||||
int stepIndex = transform.GetSiblingIndex() + 1;
|
||||
var sm = FindObjectOfType<StepManager>();
|
||||
if (sm != null) sm.RecordWomanStep(stepIndex);
|
||||
ActionHistory.Push(ActionHistory.ActionType.Woman, this);
|
||||
|
||||
// point1 点击后先激活 Shose
|
||||
if (stepIndex == 1)
|
||||
|
||||
Reference in New Issue
Block a user