From 0c218eb0d5559093e706dcd446412ecf294775df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Feb 2019 21:24:02 +0900 Subject: [PATCH] Apply new RulesetInputManager logic Run UpdateSubTree twice to ensure correctness --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 37 ++++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 96775ab9c1..3e201e2c0d 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -121,6 +121,8 @@ namespace osu.Game.Rulesets.UI private const int max_catch_up_updates_per_frame = 50; + private const double sixty_frame_time = 1000.0 / 60; + public override bool UpdateSubTree() { requireMoreUpdateLoops = true; @@ -130,25 +132,28 @@ namespace osu.Game.Rulesets.UI while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame) { - if (!base.UpdateSubTree()) - return false; + updateClock(); - UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); - - if (isAttached) + //if (Clock.ElapsedFrameTime > sixty_frame_time) { - // When handling replay input, we need to consider the possibility of fast-forwarding, which may cause the clock to be updated - // to a point very far into the future, then playing a frame at that time. In such a case, lifetime MUST be updated before - // input is handled. This is why base.Update is not called from the derived Update when handling replay input, and is instead - // called manually at the correct time here. - base.Update(); + base.UpdateSubTree(); + UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); } + + // When handling replay input, we need to consider the possibility of fast-forwarding, which may cause the clock to be updated + // to a point very far into the future, then playing a frame at that time. In such a case, lifetime MUST be updated before + // input is handled. This is why base.Update is not called from the derived Update when handling replay input, and is instead + // called manually at the correct time here. + base.Update(); + + base.UpdateSubTree(); + UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); } return true; } - protected override void Update() + private void updateClock() { if (parentClock == null) return; @@ -178,12 +183,11 @@ namespace osu.Game.Rulesets.UI // The manual clock time has changed in the above code. The framed clock now needs to be updated // to ensure that the its time is valid for our children before input is processed Clock.ProcessFrame(); + } - if (!isAttached) - { - // For non-replay input handling, this provides equivalent input ordering as if Update was not overridden - base.Update(); - } + protected override void Update() + { + // block update from base.UpdateSubTree() } #endregion @@ -211,6 +215,7 @@ namespace osu.Game.Rulesets.UI return false; break; } + return base.Handle(e); }