fix(content): cancel obsolete guides after committed movement

This commit is contained in:
NINI
2026-10-05 13:10:31 +09:00
parent 64f4f19ae9
commit 1f26fbc421
2 changed files with 21 additions and 0 deletions
@@ -154,6 +154,26 @@ namespace MagnetismHeroes.Tests
Assert.That(_app.Presenter.Balls.Values.Where(ball=>ball.Hinted).Select(ball=>ball.BallId), Is.EquivalentTo(hint.BallIds));
Assert.That(_app.Voice.CurrentClipId, Is.EqualTo(hint.VoiceId));
}
[UnityTest] public IEnumerator CollectingCurrentHelpTargetCancelsOldFindGuideWithoutLosingNumberQueue()
{
_app.StartStage(3); yield return null; _app.ShowHelp(); var hint=_app.Session.Hint;
Assert.That(_app.Voice.CurrentClipId, Is.EqualTo("guide_find"));
_app.CommitMove(hint.FirstGroupId,new Position3(.1f,0,0));
Assert.That(_app.Voice.CurrentClipId, Is.Null,"Committed collection invalidates that old target guide.");
_app.StartStage(2); var groups=_app.Session.Board.Groups;
_app.CommitMove(groups[0].id,new Position3(.1f,0,0),groups[1].id); _app.CountBall(_app.Session.Board.Balls[0].id);
_app.ShowHelp(); int pending=_app.Voice.PendingCount;
_app.CommitMove(_app.Session.Board.Groups[0].id,new Position3(.1f,0,0));
Assert.That(_app.Voice.PendingCount, Is.EqualTo(pending)); Assert.That(_app.Voice.CurrentClipId, Is.EqualTo("count_01"));
}
[UnityTest] public IEnumerator SuccessfulCurrentHelpMergeCancelsCompositionGuideInSameFreeBoard()
{
_app.StartStage(7); yield return null; _app.ShowHelp(); var hint=_app.Session.Hint;
Assert.That(_app.Voice.CurrentClipId, Is.EqualTo("guide_merge"));
_app.CommitMove(hint.FirstGroupId,new Position3(.1f,0,0),hint.SecondGroupId);
Assert.That(_app.Session.Screen, Is.EqualTo(SessionScreen.FreePlay));
Assert.That(_app.Voice.CurrentClipId, Is.Null,"Successful merge cannot retain the obsolete composition guide.");
}
}
}
#endif
@@ -139,6 +139,7 @@ namespace MagnetismHeroes.UnityRuntime.Bootstrap
public void CommitMove(string groupId, Position3 delta, string mergeTarget = null)
{
var result = mergeTarget == null ? Session.MoveGroup(groupId, delta) : Session.MoveAndMerge(groupId, delta, mergeTarget);
if (result.Accepted) _voice.CancelGuide();
Refresh(false);
if (result.Accepted && Session.Screen == SessionScreen.Puzzle && Session.Board.CanCount) _voice.Guide("guide_count");
}