From 07392a4d3eb7ff9c08c863d0aaf27cb33161dac7 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 6 Mar 2024 01:10:22 +0300 Subject: [PATCH] Further simplify transform application --- .../StoryboardElementWithDuration.cs | 37 +++---------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/osu.Game/Storyboards/StoryboardElementWithDuration.cs b/osu.Game/Storyboards/StoryboardElementWithDuration.cs index 0c89b40c36..06924a26ef 100644 --- a/osu.Game/Storyboards/StoryboardElementWithDuration.cs +++ b/osu.Game/Storyboards/StoryboardElementWithDuration.cs @@ -222,38 +222,13 @@ namespace osu.Game.Storyboards initializeProperty?.Invoke(drawable, command.StartValue); using (drawable.BeginAbsoluteSequence(command.StartTime)) - transform(drawable); - } + { + var sequence = command.IsParameterCommand + ? drawable.TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration).TransformTo(command.PropertyName, command.EndValue) + : drawable.TransformTo(command.PropertyName, command.StartValue).Then().TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing); - private void transform(TDrawable drawable) - { - if (command.IsParameterCommand) - { - if (command.LoopCount == 0) - { - drawable.TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration) - .TransformTo(command.PropertyName, command.EndValue); - } - else - { - drawable.TransformTo(command.PropertyName, command.StartValue).Delay(command.Duration) - .TransformTo(command.PropertyName, command.EndValue) - .Loop(command.Delay, command.LoopCount); - } - } - else - { - if (command.LoopCount == 0) - { - drawable.TransformTo(command.PropertyName, command.StartValue).Then() - .TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing); - } - else - { - drawable.TransformTo(command.PropertyName, command.StartValue).Then() - .TransformTo(command.PropertyName, command.EndValue, command.Duration, command.Easing) - .Loop(command.Delay, command.LoopCount); - } + if (command.LoopCount > 0) + sequence.Loop(command.Delay, command.LoopCount); } } }