From 7e98d319d85daeab6a5871e397ae102efa8bd2b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 25 Jul 2023 20:07:01 +0200 Subject: [PATCH] Use update-invariant way of checking for second press on same frame Fixes the same issue that 970ea50269f8b248b69aa458a4baa0aa41e7e45b did, but with no `AlwaysPresent` usage. --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 6 ------ .../Objects/Drawables/DrawableHit.cs | 18 +++++------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index ad17955f75..2c3b4a8d18 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -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 diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 44225ab289..1ef426854e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private bool validActionPressed; - private bool pressHandledThisFrame; + private double? lastPressHandleTime; private readonly Bindable type = new Bindable(); @@ -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 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);