Reorder the way input is handled for replays

Fixes https://github.com/ppy/osu/issues/1625 .
This commit is contained in:
smoogipoo 2018-01-25 17:39:10 +09:00
parent 08ffd886e3
commit 57cd50c45e
2 changed files with 18 additions and 2 deletions

View File

@ -71,6 +71,8 @@ public abstract class DrawableHitObject : Container, IHasAccentColour
public override bool HandleKeyboardInput => Interactive;
public override bool HandleMouseInput => Interactive;
public override bool MaskingAffectsInput => false;
public override bool RemoveWhenNotAlive => false;
public override bool RemoveCompletedTransforms => false;
protected override bool RequiresChildrenUpdate => true;

View File

@ -136,9 +136,20 @@ public override bool UpdateSubTree()
int loops = 0;
while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame)
{
if (!base.UpdateSubTree())
return false;
if (isAttached)
{
// 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();
}
}
return true;
}
@ -173,8 +184,11 @@ protected override void Update()
// to ensure that the its time is valid for our children before input is processed
Clock.ProcessFrame();
// Process input
base.Update();
if (!isAttached)
{
// For non-replay input handling, this provides equivalent input ordering as if Update was not overridden
base.Update();
}
}
#endregion