fix(content): cancel obsolete guides after committed movement
This commit is contained in:
@@ -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.Presenter.Balls.Values.Where(ball=>ball.Hinted).Select(ball=>ball.BallId), Is.EquivalentTo(hint.BallIds));
|
||||||
Assert.That(_app.Voice.CurrentClipId, Is.EqualTo(hint.VoiceId));
|
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
|
#endif
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ namespace MagnetismHeroes.UnityRuntime.Bootstrap
|
|||||||
public void CommitMove(string groupId, Position3 delta, string mergeTarget = null)
|
public void CommitMove(string groupId, Position3 delta, string mergeTarget = null)
|
||||||
{
|
{
|
||||||
var result = mergeTarget == null ? Session.MoveGroup(groupId, delta) : Session.MoveAndMerge(groupId, delta, mergeTarget);
|
var result = mergeTarget == null ? Session.MoveGroup(groupId, delta) : Session.MoveAndMerge(groupId, delta, mergeTarget);
|
||||||
|
if (result.Accepted) _voice.CancelGuide();
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
if (result.Accepted && Session.Screen == SessionScreen.Puzzle && Session.Board.CanCount) _voice.Guide("guide_count");
|
if (result.Accepted && Session.Screen == SessionScreen.Puzzle && Session.Board.CanCount) _voice.Guide("guide_count");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user