mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Restore hyper dash state on revert judgement result
This commit is contained in:
parent
cb76a2d7b5
commit
100b365c98
@ -57,7 +57,36 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestCatcherStateRevert()
|
||||
public void TestCatcherHyperStateReverted()
|
||||
{
|
||||
DrawableCatchHitObject drawableObject1 = null;
|
||||
DrawableCatchHitObject drawableObject2 = null;
|
||||
JudgementResult result1 = null;
|
||||
JudgementResult result2 = null;
|
||||
AddStep("catch hyper fruit", () =>
|
||||
{
|
||||
drawableObject1 = createDrawableObject(new Fruit { HyperDashTarget = new Fruit { X = 100 } });
|
||||
result1 = attemptCatch(drawableObject1);
|
||||
});
|
||||
AddStep("catch normal fruit", () =>
|
||||
{
|
||||
drawableObject2 = createDrawableObject(new Fruit());
|
||||
result2 = attemptCatch(drawableObject2);
|
||||
});
|
||||
AddStep("revert second result", () =>
|
||||
{
|
||||
catcher.OnRevertResult(drawableObject2, result2);
|
||||
});
|
||||
checkHyperDash(true);
|
||||
AddStep("revert first result", () =>
|
||||
{
|
||||
catcher.OnRevertResult(drawableObject1, result1);
|
||||
});
|
||||
checkHyperDash(false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCatcherAnimationStateReverted()
|
||||
{
|
||||
DrawableCatchHitObject drawableObject = null;
|
||||
JudgementResult result = null;
|
||||
|
@ -15,6 +15,11 @@ namespace osu.Game.Rulesets.Catch.Judgements
|
||||
/// </summary>
|
||||
public CatcherAnimationState CatcherAnimationState;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the catcher was hyper dashing prior to this judgement.
|
||||
/// </summary>
|
||||
public bool CatcherHyperDash;
|
||||
|
||||
public CatchJudgementResult([NotNull] HitObject hitObject, [NotNull] Judgement judgement)
|
||||
: base(hitObject, judgement)
|
||||
{
|
||||
|
@ -213,6 +213,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
var catchResult = (CatchJudgementResult)result;
|
||||
catchResult.CatcherAnimationState = CurrentState;
|
||||
catchResult.CatcherHyperDash = HyperDashing;
|
||||
|
||||
if (!(drawableObject.HitObject is PalpableCatchHitObject hitObject)) return;
|
||||
|
||||
@ -243,7 +244,17 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
public void OnRevertResult(DrawableCatchHitObject fruit, JudgementResult result)
|
||||
{
|
||||
var catchResult = (CatchJudgementResult)result;
|
||||
updateState(catchResult.CatcherAnimationState);
|
||||
|
||||
if (CurrentState != catchResult.CatcherAnimationState)
|
||||
updateState(catchResult.CatcherAnimationState);
|
||||
|
||||
if (HyperDashing != catchResult.CatcherHyperDash)
|
||||
{
|
||||
if (catchResult.CatcherHyperDash)
|
||||
SetHyperDashState(2);
|
||||
else
|
||||
SetHyperDashState();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user