1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Use update-invariant way of checking for second press on same frame

Fixes the same issue that 970ea50269 did,
but with no `AlwaysPresent` usage.
This commit is contained in:
Bartłomiej Dach 2023-07-25 20:07:01 +02:00
parent 5cedd428bb
commit 7e98d319d8
No known key found for this signature in database
2 changed files with 5 additions and 19 deletions

View File

@ -57,12 +57,6 @@ namespace osu.Game.Rulesets.Taiko.Mods
{
hitObject.FadeOut(duration);
// Keep updating the object even after it stopped being visible.
// This is required because of the custom logic in DrawableHit's Update method.
// Specifically, pressHandledThisFrame wasn't reset, which caused further hits
// within the object's lifetime to be rejected.
hitObject.AlwaysPresent = true;
// DrawableHitObject sets LifetimeEnd to LatestTransformEndTime if it isn't manually changed.
// in order for the object to not be killed before its actual end time (as the latest transform ends earlier), set lifetime end explicitly.
hitObject.LifetimeEnd = state == ArmedState.Idle || !hitObject.AllJudged

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
private bool validActionPressed;
private bool pressHandledThisFrame;
private double? lastPressHandleTime;
private readonly Bindable<HitType> type = new Bindable<HitType>();
@ -76,7 +76,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
HitActions = null;
HitAction = null;
validActionPressed = pressHandledThisFrame = false;
validActionPressed = false;
lastPressHandleTime = null;
}
private void updateActionsFromType()
@ -114,7 +115,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
{
if (pressHandledThisFrame)
if (lastPressHandleTime == Time.Current)
return true;
if (Judged)
return false;
@ -128,7 +129,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
// Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded
// E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note
pressHandledThisFrame = true;
lastPressHandleTime = Time.Current;
return result;
}
@ -139,15 +140,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
base.OnReleased(e);
}
protected override void Update()
{
base.Update();
// The input manager processes all input prior to us updating, so this is the perfect time
// for us to remove the extra press blocking, before input is handled in the next frame
pressHandledThisFrame = false;
}
protected override void UpdateHitStateTransforms(ArmedState state)
{
Debug.Assert(HitObject.HitWindows != null);