Merge branch 'master' into fix-scrolling-lifetime

This commit is contained in:
smoogipoo
2021-06-02 11:08:28 +09:00
72 changed files with 923 additions and 290 deletions

View File

@ -1,31 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics;
namespace osu.Game.Rulesets.Objects.Drawables
{
/// <summary>
/// An interface that exposes properties required for scrolling hit objects to be properly displayed.
/// </summary>
internal interface IScrollingHitObject : IDrawable
{
/// <summary>
/// Time offset before the hit object start time at which this <see cref="IScrollingHitObject"/> becomes visible and the time offset
/// after the hit object's end time after which it expires.
///
/// <para>
/// This provides only a default life time range, however classes inheriting from <see cref="IScrollingHitObject"/> should override
/// their life times if more tight control is desired.
/// </para>
/// </summary>
BindableDouble LifetimeOffset { get; }
/// <summary>
/// Axes which this <see cref="IScrollingHitObject"/> will scroll through.
/// This is set by the container which this scrolls through.
/// </summary>
Axes ScrollingAxes { set; }
}
}

View File

@ -35,10 +35,8 @@ namespace osu.Game.Rulesets.Objects.Pooling
if (Entry == null && LifetimeStart != value)
throw new InvalidOperationException($"Cannot modify lifetime of {nameof(PoolableDrawableWithLifetime<TEntry>)} when entry is not set");
if (Entry == null) return;
Entry.LifetimeStart = value;
base.LifetimeStart = Entry.LifetimeStart;
if (Entry != null)
Entry.LifetimeStart = value;
}
}
@ -50,10 +48,8 @@ namespace osu.Game.Rulesets.Objects.Pooling
if (Entry == null && LifetimeEnd != value)
throw new InvalidOperationException($"Cannot modify lifetime of {nameof(PoolableDrawableWithLifetime<TEntry>)} when entry is not set");
if (Entry == null) return;
Entry.LifetimeEnd = value;
base.LifetimeEnd = Entry.LifetimeEnd;
if (Entry != null)
Entry.LifetimeEnd = value;
}
}
@ -84,8 +80,8 @@ namespace osu.Game.Rulesets.Objects.Pooling
free();
Entry = entry;
entry.LifetimeChanged += entryLifetimeChanged;
setLifetimeFromEntry();
entry.LifetimeChanged += setLifetimeFromEntry;
setLifetimeFromEntry(entry);
OnApply(entry);
@ -121,23 +117,19 @@ namespace osu.Game.Rulesets.Objects.Pooling
OnFree(Entry);
Entry.LifetimeChanged -= entryLifetimeChanged;
Entry.LifetimeChanged -= setLifetimeFromEntry;
Entry = null;
setLifetimeFromEntry();
base.LifetimeStart = double.MinValue;
base.LifetimeEnd = double.MaxValue;
HasEntryApplied = false;
}
private void entryLifetimeChanged(LifetimeEntry entry)
private void setLifetimeFromEntry(LifetimeEntry entry)
{
Debug.Assert(entry == Entry);
setLifetimeFromEntry();
}
private void setLifetimeFromEntry()
{
base.LifetimeStart = Entry?.LifetimeStart ?? double.MinValue;
base.LifetimeEnd = Entry?.LifetimeEnd ?? double.MaxValue;
base.LifetimeStart = entry.LifetimeStart;
base.LifetimeEnd = entry.LifetimeEnd;
}
}
}