mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Merge pull request #13258 from ekrctb/fix-scrolling-lifetime
Fix lifetime of scrolling hit object not updated when scrolling speed is adjusted
This commit is contained in:
@ -90,6 +90,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
assertChildPosition(5);
|
||||
}
|
||||
|
||||
[TestCase("pooled")]
|
||||
[TestCase("non-pooled")]
|
||||
public void TestLifetimeRecomputedWhenTimeRangeChanges(string pooled)
|
||||
{
|
||||
var beatmap = createBeatmap(_ => pooled == "pooled" ? new TestPooledHitObject() : new TestHitObject());
|
||||
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = time_range });
|
||||
createTest(beatmap);
|
||||
|
||||
assertDead(3);
|
||||
|
||||
AddStep("increase time range", () => drawableRuleset.TimeRange.Value = 3 * time_range);
|
||||
assertPosition(3, 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRelativeBeatLengthScaleSingleTimingPoint()
|
||||
{
|
||||
|
@ -35,11 +35,11 @@ namespace osu.Game.Rulesets.Objects
|
||||
HitObject = hitObject;
|
||||
|
||||
startTimeBindable.BindTo(HitObject.StartTimeBindable);
|
||||
startTimeBindable.BindValueChanged(_ => setInitialLifetime(), true);
|
||||
startTimeBindable.BindValueChanged(_ => SetInitialLifetime(), true);
|
||||
|
||||
// Subscribe to this event before the DrawableHitObject so that the local callback is invoked before the entry is re-applied as a result of DefaultsApplied.
|
||||
// This way, the DrawableHitObject can use OnApply() to overwrite the LifetimeStart that was set inside setInitialLifetime().
|
||||
HitObject.DefaultsApplied += _ => setInitialLifetime();
|
||||
HitObject.DefaultsApplied += _ => SetInitialLifetime();
|
||||
}
|
||||
|
||||
// The lifetime, as set by the hitobject.
|
||||
@ -94,6 +94,6 @@ namespace osu.Game.Rulesets.Objects
|
||||
/// <summary>
|
||||
/// Set <see cref="LifetimeEntry.LifetimeStart"/> using <see cref="InitialLifetimeOffset"/>.
|
||||
/// </summary>
|
||||
private void setInitialLifetime() => LifetimeStart = HitObject.StartTime - InitialLifetimeOffset;
|
||||
internal void SetInitialLifetime() => LifetimeStart = HitObject.StartTime - InitialLifetimeOffset;
|
||||
}
|
||||
}
|
||||
|
@ -172,11 +172,12 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
|
||||
if (layoutCache.IsValid) return;
|
||||
|
||||
foreach (var hitObject in Objects)
|
||||
{
|
||||
if (hitObject.HitObject != null)
|
||||
invalidateHitObject(hitObject);
|
||||
}
|
||||
layoutComputed.Clear();
|
||||
|
||||
// Reset lifetime to the conservative estimation.
|
||||
// If a drawable becomes alive by this lifetime, its lifetime will be updated to a more precise lifetime in the next update.
|
||||
foreach (var entry in Entries)
|
||||
entry.SetInitialLifetime();
|
||||
|
||||
scrollingInfo.Algorithm.Reset();
|
||||
|
||||
|
Reference in New Issue
Block a user