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