1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 11:27:24 +08:00

Apply new RulesetInputManager logic

Run UpdateSubTree twice to ensure correctness
This commit is contained in:
Dean Herbert 2019-02-21 21:24:02 +09:00
parent c877801441
commit 0c218eb0d5

View File

@ -121,6 +121,8 @@ namespace osu.Game.Rulesets.UI
private const int max_catch_up_updates_per_frame = 50; private const int max_catch_up_updates_per_frame = 50;
private const double sixty_frame_time = 1000.0 / 60;
public override bool UpdateSubTree() public override bool UpdateSubTree()
{ {
requireMoreUpdateLoops = true; requireMoreUpdateLoops = true;
@ -130,25 +132,28 @@ namespace osu.Game.Rulesets.UI
while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame) while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame)
{ {
if (!base.UpdateSubTree()) updateClock();
return false;
UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); //if (Clock.ElapsedFrameTime > sixty_frame_time)
if (isAttached)
{ {
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 // 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 // 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 // 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. // called manually at the correct time here.
base.Update(); base.Update();
}
base.UpdateSubTree();
UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat);
} }
return true; return true;
} }
protected override void Update() private void updateClock()
{ {
if (parentClock == null) return; 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 // 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 // to ensure that the its time is valid for our children before input is processed
Clock.ProcessFrame(); 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 #endregion
@ -211,6 +215,7 @@ namespace osu.Game.Rulesets.UI
return false; return false;
break; break;
} }
return base.Handle(e); return base.Handle(e);
} }