1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-11 02:53:21 +08:00
osu-lazer/osu.Game/Screens/Edit/Commands/SetStartTimeCommand.cs
2024-10-08 20:56:17 +02:00

28 lines
812 B
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Screens.Edit.Commands
{
public class SetStartTimeCommand : IEditorCommand
{
public readonly HitObject Target;
public readonly double StartTime;
public SetStartTimeCommand(HitObject target, double startTime)
{
Target = target;
StartTime = startTime;
}
public void Apply() => Target.StartTime = StartTime;
public IEditorCommand CreateUndo() => new SetStartTimeCommand(Target, Target.StartTime);
public bool IsRedundant => Precision.AlmostEquals(StartTime, Target.StartTime);
}
}