2017-09-08 05:55:05 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
2017-09-08 18:11:57 +08:00
|
|
|
|
using osu.Framework.Graphics.Transforms;
|
2017-09-08 05:55:05 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Storyboards
|
|
|
|
|
{
|
|
|
|
|
public class CommandLoop : CommandTimelineGroup
|
|
|
|
|
{
|
2017-09-08 18:11:57 +08:00
|
|
|
|
public double LoopStartTime;
|
|
|
|
|
public int LoopCount;
|
2017-09-08 05:55:05 +08:00
|
|
|
|
|
|
|
|
|
public CommandLoop(double startTime, int loopCount)
|
|
|
|
|
{
|
2017-09-08 18:11:57 +08:00
|
|
|
|
LoopStartTime = startTime;
|
|
|
|
|
LoopCount = loopCount;
|
2017-09-08 05:55:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-08 18:11:57 +08:00
|
|
|
|
public override void ApplyTransforms(Drawable drawable, double offset = 0)
|
|
|
|
|
=> base.ApplyTransforms(drawable, offset + LoopStartTime);
|
|
|
|
|
|
2017-09-08 19:04:53 +08:00
|
|
|
|
protected override void PostProcess(ICommand command, TransformSequence<Drawable> sequence)
|
2017-09-08 18:11:57 +08:00
|
|
|
|
=> sequence.Loop(Duration - command.Duration, LoopCount);
|
2017-09-08 05:55:05 +08:00
|
|
|
|
|
|
|
|
|
public override string ToString()
|
2017-09-08 18:11:57 +08:00
|
|
|
|
=> $"{LoopStartTime} x{LoopCount}";
|
2017-09-08 05:55:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|