Restore catcher state on revert judgement result

This commit is contained in:
ekrctb
2020-12-08 15:02:55 +09:00
parent 0213f77b4b
commit cb76a2d7b5
4 changed files with 62 additions and 9 deletions

View File

@ -56,6 +56,24 @@ namespace osu.Game.Rulesets.Catch.Tests
};
});
[Test]
public void TestCatcherStateRevert()
{
DrawableCatchHitObject drawableObject = null;
JudgementResult result = null;
AddStep("catch kiai fruit", () =>
{
drawableObject = createDrawableObject(new TestKiaiFruit());
result = attemptCatch(drawableObject);
});
checkState(CatcherAnimationState.Kiai);
AddStep("revert result", () =>
{
catcher.OnRevertResult(drawableObject, result);
});
checkState(CatcherAnimationState.Idle);
}
[Test]
public void TestCatcherCatchWidth()
{
@ -170,17 +188,19 @@ namespace osu.Game.Rulesets.Catch.Tests
private void attemptCatch(CatchHitObject hitObject, int count = 1)
{
hitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
for (var i = 0; i < count; i++)
attemptCatch(createDrawableObject(hitObject));
}
private JudgementResult attemptCatch(DrawableCatchHitObject drawableObject)
{
drawableObject.HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
var result = new CatchJudgementResult(drawableObject.HitObject, drawableObject.HitObject.CreateJudgement())
{
var drawableObject = createDrawableObject(hitObject);
var result = new JudgementResult(hitObject, new CatchJudgement())
{
Type = catcher.CanCatch(hitObject) ? HitResult.Great : HitResult.Miss
};
catcher.OnNewResult(drawableObject, result);
}
Type = catcher.CanCatch(drawableObject.HitObject) ? HitResult.Great : HitResult.Miss
};
catcher.OnNewResult(drawableObject, result);
return result;
}
private DrawableCatchHitObject createDrawableObject(CatchHitObject hitObject)