osu/osu.Game/Storyboards/IStoryboardElement.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
1.0 KiB
C#
Raw Normal View History

// 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.
2018-04-13 09:19:50 +00:00
2017-09-07 21:55:05 +00:00
using osu.Framework.Graphics;
2018-04-13 09:19:50 +00:00
2017-09-07 21:55:05 +00:00
namespace osu.Game.Storyboards
{
2017-09-13 09:22:24 +00:00
public interface IStoryboardElement
2017-09-07 21:55:05 +00:00
{
string Path { get; }
bool IsDrawable { get; }
2018-04-13 09:19:50 +00:00
double StartTime { get; }
2017-09-07 21:55:05 +00:00
Drawable CreateDrawable();
}
public static class StoryboardElementExtensions
{
/// <summary>
2021-04-18 03:35:54 +00:00
/// Returns the end time of this storyboard element.
/// </summary>
/// <remarks>
/// This returns the <see cref="IStoryboardElementWithDuration.EndTime"/> where available, falling back to <see cref="IStoryboardElement.StartTime"/> otherwise.
/// </remarks>
2021-04-18 03:35:54 +00:00
/// <param name="element">The storyboard element.</param>
/// <returns>The end time of this element.</returns>
public static double GetEndTime(this IStoryboardElement element) => (element as IStoryboardElementWithDuration)?.EndTime ?? element.StartTime;
}
2017-09-07 21:55:05 +00:00
}