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

Fix CommandLoop start and end time.

This commit is contained in:
Damnae 2017-09-08 18:03:04 +02:00
parent e63fb5720c
commit 3f2598543c
2 changed files with 11 additions and 3 deletions

View File

@ -11,6 +11,9 @@ namespace osu.Game.Storyboards
public double LoopStartTime;
public int LoopCount;
public override double StartTime => LoopStartTime;
public override double EndTime => LoopStartTime + CommandsDuration * LoopCount;
public CommandLoop(double startTime, int loopCount)
{
LoopStartTime = startTime;
@ -21,7 +24,7 @@ namespace osu.Game.Storyboards
=> base.ApplyTransforms(drawable, offset + LoopStartTime);
protected override void PostProcess(ICommand command, TransformSequence<Drawable> sequence)
=> sequence.Loop(Duration - command.Duration, LoopCount);
=> sequence.Loop(CommandsDuration - command.Duration, LoopCount);
public override string ToString()
=> $"{LoopStartTime} x{LoopCount}";

View File

@ -39,9 +39,14 @@ namespace osu.Game.Storyboards
}
}
public double StartTime => Timelines.Where(t => t.HasCommands).Min(t => t.StartTime);
public double EndTime => Timelines.Where(t => t.HasCommands).Max(t => t.EndTime);
public double CommandsStartTime => Timelines.Where(t => t.HasCommands).Min(t => t.StartTime);
public double CommandsEndTime => Timelines.Where(t => t.HasCommands).Max(t => t.EndTime);
public double CommandsDuration => CommandsEndTime - CommandsStartTime;
public virtual double StartTime => CommandsStartTime;
public virtual double EndTime => CommandsEndTime;
public double Duration => EndTime - StartTime;
public bool HasCommands => Timelines.Any(t => t.HasCommands);
public virtual void ApplyTransforms(Drawable drawable, double offset = 0)