mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Perserve miss animation when followed by a hit at same frame
This commit is contained in:
parent
986f4fa407
commit
20fd458fac
@ -134,6 +134,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
AddUntilStep("wait for health", () => healthDisplay.Current.Value == 1);
|
||||
AddStep("set half health", () => healthProcessor.Health.Value = 0.5f);
|
||||
|
||||
AddStep("apply miss and hit", () =>
|
||||
{
|
||||
applyMiss();
|
||||
@ -141,7 +142,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
applyPerfectHit();
|
||||
applyPerfectHit();
|
||||
});
|
||||
|
||||
AddWaitStep("wait", 3);
|
||||
|
||||
AddStep("apply miss and cancel with hit", () =>
|
||||
{
|
||||
applyMiss();
|
||||
|
@ -151,7 +151,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
};
|
||||
}
|
||||
|
||||
private JudgementResult? pendingJudgementResult;
|
||||
private bool pendingMissAnimation;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
@ -171,7 +171,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
BarHeight.BindValueChanged(_ => updatePath(), true);
|
||||
}
|
||||
|
||||
private void onNewJudgement(JudgementResult result) => pendingJudgementResult = result;
|
||||
private void onNewJudgement(JudgementResult result) => pendingMissAnimation |= !result.IsHit;
|
||||
|
||||
private void onCurrentChanged(ValueChangedEvent<double> valueChangedEvent)
|
||||
// schedule display updates one frame later to ensure we know the judgement result causing this change (if there is one).
|
||||
@ -179,22 +179,23 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
var result = pendingJudgementResult;
|
||||
double newHealth = Current.Value;
|
||||
|
||||
if (Current.Value >= GlowBarValue)
|
||||
if (newHealth >= GlowBarValue)
|
||||
finishMissDisplay();
|
||||
|
||||
double time = Current.Value > GlowBarValue ? 500 : 250;
|
||||
double time = newHealth > GlowBarValue ? 500 : 250;
|
||||
|
||||
// TODO: this should probably use interpolation in update.
|
||||
this.TransformTo(nameof(HealthBarValue), Current.Value, time, Easing.OutQuint);
|
||||
this.TransformTo(nameof(HealthBarValue), newHealth, time, Easing.OutQuint);
|
||||
|
||||
if (result != null && !result.IsHit)
|
||||
if (pendingMissAnimation && newHealth < GlowBarValue)
|
||||
triggerMissDisplay();
|
||||
else if (!displayingMiss)
|
||||
this.TransformTo(nameof(GlowBarValue), Current.Value, time, Easing.OutQuint);
|
||||
|
||||
pendingJudgementResult = null;
|
||||
pendingMissAnimation = false;
|
||||
|
||||
if (!displayingMiss)
|
||||
this.TransformTo(nameof(GlowBarValue), newHealth, time, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
Loading…
Reference in New Issue
Block a user