mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Make use of framework's transform loops
This commit is contained in:
parent
c05007804f
commit
7193ec66a4
@ -38,11 +38,21 @@ namespace osu.Game.Storyboards
|
|||||||
|
|
||||||
public override IEnumerable<CommandTimeline<T>.TypedCommand> GetCommands<T>(CommandTimelineSelector<T> timelineSelector, double offset = 0)
|
public override IEnumerable<CommandTimeline<T>.TypedCommand> GetCommands<T>(CommandTimelineSelector<T> timelineSelector, double offset = 0)
|
||||||
{
|
{
|
||||||
for (int loop = 0; loop < TotalIterations; loop++)
|
double fullLoopDuration = CommandsEndTime - CommandsStartTime;
|
||||||
|
|
||||||
|
foreach (var command in timelineSelector(this).Commands)
|
||||||
{
|
{
|
||||||
double loopOffset = LoopStartTime + loop * CommandsDuration;
|
yield return new CommandTimeline<T>.TypedCommand
|
||||||
foreach (var command in base.GetCommands(timelineSelector, offset + loopOffset))
|
{
|
||||||
yield return command;
|
Easing = command.Easing,
|
||||||
|
StartTime = offset + LoopStartTime + command.StartTime,
|
||||||
|
EndTime = offset + LoopStartTime + command.EndTime,
|
||||||
|
StartValue = command.StartValue,
|
||||||
|
EndValue = command.EndValue,
|
||||||
|
PropertyName = command.PropertyName,
|
||||||
|
LoopCount = TotalIterations,
|
||||||
|
Delay = fullLoopDuration - command.EndTime + command.StartTime
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,8 @@ namespace osu.Game.Storyboards
|
|||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
public double Duration => EndTime - StartTime;
|
public double Duration => EndTime - StartTime;
|
||||||
public string PropertyName { get; set; }
|
public string PropertyName { get; set; }
|
||||||
|
public int LoopCount { get; set; }
|
||||||
|
public double Delay { get; set; }
|
||||||
|
|
||||||
public T StartValue;
|
public T StartValue;
|
||||||
public T EndValue;
|
public T EndValue;
|
||||||
|
@ -218,41 +218,86 @@ namespace osu.Game.Storyboards
|
|||||||
switch (command.PropertyName)
|
switch (command.PropertyName)
|
||||||
{
|
{
|
||||||
case "VectorScale":
|
case "VectorScale":
|
||||||
|
if (command.LoopCount == 0)
|
||||||
|
{
|
||||||
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
||||||
{
|
{
|
||||||
((IVectorScalable)drawable).TransformTo(command.PropertyName, command.StartValue).Then().TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing);
|
((IVectorScalable)drawable).TransformTo(command.PropertyName, command.StartValue).Then()
|
||||||
|
.TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
||||||
|
{
|
||||||
|
((IVectorScalable)drawable).TransformTo(command.PropertyName, command.StartValue).Then()
|
||||||
|
.TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing)
|
||||||
|
.Loop(command.Delay, command.LoopCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "FlipH":
|
case "FlipH":
|
||||||
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
|
||||||
{
|
|
||||||
((IFlippable)drawable).TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration).TransformTo(command.PropertyName, command.EndValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "FlipV":
|
case "FlipV":
|
||||||
|
if (command.LoopCount == 0)
|
||||||
|
{
|
||||||
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
||||||
{
|
{
|
||||||
((IFlippable)drawable).TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration).TransformTo(command.PropertyName, command.EndValue);
|
((IFlippable)drawable).TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration)
|
||||||
|
.TransformTo(command.PropertyName, command.EndValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
||||||
|
{
|
||||||
|
((IFlippable)drawable).TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration)
|
||||||
|
.TransformTo(command.PropertyName, command.EndValue)
|
||||||
|
.Loop(command.Delay, command.LoopCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Blending":
|
case "Blending":
|
||||||
|
if (command.LoopCount == 0)
|
||||||
|
{
|
||||||
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
||||||
{
|
{
|
||||||
drawable.TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration).TransformTo(command.PropertyName, command.EndValue);
|
drawable.TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration)
|
||||||
|
.TransformTo(command.PropertyName, command.EndValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
||||||
|
{
|
||||||
|
drawable.TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration)
|
||||||
|
.TransformTo(command.PropertyName, command.EndValue)
|
||||||
|
.Loop(command.Delay, command.LoopCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (command.LoopCount == 0)
|
||||||
|
{
|
||||||
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
||||||
{
|
{
|
||||||
drawable.TransformTo(command.PropertyName, command.StartValue).Then().TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing);
|
drawable.TransformTo(command.PropertyName, command.StartValue).Then()
|
||||||
|
.TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (drawable.BeginAbsoluteSequence(command.StartTime))
|
||||||
|
{
|
||||||
|
drawable.TransformTo(command.PropertyName, command.StartValue).Then()
|
||||||
|
.TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing)
|
||||||
|
.Loop(command.Delay, command.LoopCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user