1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 15:02:54 +08:00

Add IHasDuration interface with EndTime for storyboard elements to implement

This commit is contained in:
Christine Chen 2021-04-15 17:17:02 -04:00
parent 45c2b72a25
commit 0e545e1ed9
6 changed files with 12 additions and 12 deletions

View File

@ -0,0 +1,10 @@
// 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.
namespace osu.Game.Storyboards
{
public interface IHasDuration
{
double EndTime { get; }
}
}

View File

@ -12,8 +12,6 @@ namespace osu.Game.Storyboards
double StartTime { get; }
double EndTime { get; }
Drawable CreateDrawable();
}
}

View File

@ -40,11 +40,7 @@ namespace osu.Game.Storyboards
/// Across all layers, find the latest point in time that a storyboard element ends at.
/// Will return null if there are no elements.
/// </summary>
/// <remarks>
/// This iterates all elements and as such should be used sparingly or stored locally.
/// Videos and samples return StartTime as their EndTIme.
/// </remarks>
public double? LatestEventTime => Layers.SelectMany(l => l.Elements).OrderByDescending(e => e.EndTime).FirstOrDefault()?.EndTime;
public double? LatestEventTime => Layers.SelectMany(l => l.Elements.OfType<IHasDuration>()).OrderByDescending(e => e.EndTime).FirstOrDefault()?.EndTime;
/// <summary>
/// Depth of the currently front-most storyboard layer, excluding the overlay layer.

View File

@ -15,8 +15,6 @@ namespace osu.Game.Storyboards
public double StartTime { get; }
public double EndTime => StartTime;
public int Volume { get; }
public IEnumerable<string> LookupNames => new[]

View File

@ -11,7 +11,7 @@ using JetBrains.Annotations;
namespace osu.Game.Storyboards
{
public class StoryboardSprite : IStoryboardElement
public class StoryboardSprite : IStoryboardElement, IHasDuration
{
private readonly List<CommandLoop> loops = new List<CommandLoop>();
private readonly List<CommandTrigger> triggers = new List<CommandTrigger>();

View File

@ -14,8 +14,6 @@ namespace osu.Game.Storyboards
public double StartTime { get; }
public double EndTime => StartTime;
public StoryboardVideo(string path, int offset)
{
Path = path;