1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Fix parameter commands applying initial value before start time

This commit is contained in:
Salman Ahmed 2024-03-08 21:52:56 +03:00
parent c1649b76d6
commit 0efa12a86a
4 changed files with 18 additions and 3 deletions

View File

@ -28,6 +28,9 @@ namespace osu.Game.Storyboards.Commands
/// <summary>
/// Sets the value of the corresponding property in <see cref="Drawable"/> to the start value of this command.
/// </summary>
/// <remarks>
/// Parameter commands (e.g. <see cref="StoryboardFlipHCommand"/> / <see cref="StoryboardFlipVCommand"/> / <see cref="StoryboardBlendingParametersCommand"/>) only apply the start value if they have zero duration, i.e. take "permanent" effect regardless of time.
/// </remarks>
/// <param name="d">The target drawable.</param>
void ApplyInitialValue<TDrawable>(TDrawable d)
where TDrawable : Drawable, IFlippable, IVectorScalable;

View File

@ -15,7 +15,11 @@ namespace osu.Game.Storyboards.Commands
public override string PropertyName => nameof(Drawable.Blending);
public override void ApplyInitialValue<TDrawable>(TDrawable d) => d.Blending = StartValue;
public override void ApplyInitialValue<TDrawable>(TDrawable d)
{
if (StartTime == EndTime)
d.Blending = StartValue;
}
public override TransformSequence<TDrawable> ApplyTransforms<TDrawable>(TDrawable d)
=> d.TransformTo(nameof(d.Blending), StartValue).Delay(Duration)

View File

@ -16,7 +16,11 @@ namespace osu.Game.Storyboards.Commands
public override string PropertyName => nameof(IFlippable.FlipH);
public override void ApplyInitialValue<TDrawable>(TDrawable d) => d.FlipH = StartValue;
public override void ApplyInitialValue<TDrawable>(TDrawable d)
{
if (StartTime == EndTime)
d.FlipH = StartValue;
}
public override TransformSequence<TDrawable> ApplyTransforms<TDrawable>(TDrawable d)
=> d.TransformTo(nameof(IFlippable.FlipH), StartValue).Delay(Duration)

View File

@ -16,7 +16,11 @@ namespace osu.Game.Storyboards.Commands
public override string PropertyName => nameof(IFlippable.FlipV);
public override void ApplyInitialValue<TDrawable>(TDrawable d) => d.FlipV = StartValue;
public override void ApplyInitialValue<TDrawable>(TDrawable d)
{
if (StartTime == EndTime)
d.FlipV = StartValue;
}
public override TransformSequence<TDrawable> ApplyTransforms<TDrawable>(TDrawable d)
=> d.TransformTo(nameof(IFlippable.FlipV), StartValue).Delay(Duration)