Fix comparison interface not implemented on storyboard command classes

This commit is contained in:
Salman Ahmed 2024-03-08 02:02:22 +03:00
parent 3755dd059a
commit 2ca36254f4
1 changed files with 8 additions and 3 deletions

View File

@ -1,12 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.Transforms;
namespace osu.Game.Storyboards.Commands namespace osu.Game.Storyboards.Commands
{ {
public abstract class StoryboardCommand<T> : IStoryboardCommand public abstract class StoryboardCommand<T> : IStoryboardCommand, IComparable<StoryboardCommand<T>>
{ {
public double StartTime { get; } public double StartTime { get; }
public double EndTime { get; } public double EndTime { get; }
@ -41,10 +42,14 @@ protected StoryboardCommand(double startTime, double endTime, T startValue, T en
/// </summary> /// </summary>
public abstract TransformSequence<Drawable> ApplyTransform(Drawable d); public abstract TransformSequence<Drawable> ApplyTransform(Drawable d);
public int CompareTo(IStoryboardCommand other) public int CompareTo(StoryboardCommand<T>? other)
{ {
if (other == null)
return 1;
int result = StartTime.CompareTo(other.StartTime); int result = StartTime.CompareTo(other.StartTime);
if (result != 0) return result; if (result != 0)
return result;
return EndTime.CompareTo(other.EndTime); return EndTime.CompareTo(other.EndTime);
} }