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:
parent
45c2b72a25
commit
0e545e1ed9
10
osu.Game/Storyboards/IHasDuration.cs
Normal file
10
osu.Game/Storyboards/IHasDuration.cs
Normal 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; }
|
||||
}
|
||||
}
|
@ -12,8 +12,6 @@ namespace osu.Game.Storyboards
|
||||
|
||||
double StartTime { get; }
|
||||
|
||||
double EndTime { get; }
|
||||
|
||||
Drawable CreateDrawable();
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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[]
|
||||
|
@ -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>();
|
||||
|
@ -14,8 +14,6 @@ namespace osu.Game.Storyboards
|
||||
|
||||
public double StartTime { get; }
|
||||
|
||||
public double EndTime => StartTime;
|
||||
|
||||
public StoryboardVideo(string path, int offset)
|
||||
{
|
||||
Path = path;
|
||||
|
Loading…
Reference in New Issue
Block a user