mirror of https://github.com/ppy/osu
Add startAtCurrentTime parameter to GetAnimation()
This commit is contained in:
parent
e862ca23ad
commit
beb1f037e9
|
@ -9,6 +9,10 @@ namespace osu.Game.Skinning
|
|||
/// <summary>
|
||||
/// Denotes an object which provides a reference time to start animations from.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This should not be used to start an animation immediately at the current time.
|
||||
/// To do so, use <see cref="LegacySkinExtensions.GetAnimation"/> with <code>startAtCurrentTime = true</code> instead.
|
||||
/// </remarks>
|
||||
[Cached]
|
||||
public interface IAnimationTimeReference
|
||||
{
|
||||
|
|
|
@ -14,7 +14,8 @@ namespace osu.Game.Skinning
|
|||
{
|
||||
public static class LegacySkinExtensions
|
||||
{
|
||||
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-")
|
||||
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-",
|
||||
bool startAtCurrentTime = false)
|
||||
{
|
||||
Texture texture;
|
||||
|
||||
|
@ -24,7 +25,7 @@ public static Drawable GetAnimation(this ISkin source, string componentName, boo
|
|||
|
||||
if (textures.Length > 0)
|
||||
{
|
||||
var animation = new SkinnableTextureAnimation
|
||||
var animation = new SkinnableTextureAnimation(startAtCurrentTime)
|
||||
{
|
||||
DefaultFrameLength = getFrameLength(source, applyConfigFrameRate, textures),
|
||||
Repeat = looping,
|
||||
|
@ -60,8 +61,8 @@ public class SkinnableTextureAnimation : TextureAnimation
|
|||
[Resolved(canBeNull: true)]
|
||||
private IAnimationTimeReference timeReference { get; set; }
|
||||
|
||||
public SkinnableTextureAnimation()
|
||||
: base(false)
|
||||
public SkinnableTextureAnimation(bool startAtCurrentTime = true)
|
||||
: base(startAtCurrentTime)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue