mirror of
https://github.com/ppy/osu
synced 2024-12-24 15:53:37 +00:00
Improve command sorting.
This commit is contained in:
parent
12de737084
commit
8d55cb7f92
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@ -47,6 +48,13 @@ namespace osu.Game.Storyboards
|
||||
public T StartValue;
|
||||
public T EndValue;
|
||||
|
||||
public int CompareTo(ICommand other)
|
||||
{
|
||||
var result = StartTime.CompareTo(other.StartTime);
|
||||
if (result != 0) return result;
|
||||
return EndTime.CompareTo(other.EndTime);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
=> $"{StartTime} -> {EndTime}, {StartValue} -> {EndValue} {Easing}";
|
||||
}
|
||||
@ -59,7 +67,7 @@ namespace osu.Game.Storyboards
|
||||
bool HasCommands { get; }
|
||||
}
|
||||
|
||||
public interface ICommand
|
||||
public interface ICommand : IComparable<ICommand>
|
||||
{
|
||||
Easing Easing { get; set; }
|
||||
double StartTime { get; set; }
|
||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Storyboards
|
||||
CommandTimelineSelector<T> timelineSelector, DrawablePropertyInitializer<T> initializeProperty, DrawableTransformer<T> transform)
|
||||
{
|
||||
var initialized = false;
|
||||
foreach (var command in getAggregatedCommands(timelineSelector, triggeredGroups))
|
||||
foreach (var command in getAggregatedCommands(timelineSelector, triggeredGroups).OrderBy(l => l))
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
@ -99,7 +99,7 @@ namespace osu.Game.Storyboards
|
||||
if (triggeredGroups != null)
|
||||
foreach (var pair in triggeredGroups)
|
||||
commands = commands.Concat(pair.Item1.GetCommands(timelineSelector, pair.Item2));
|
||||
return commands.OrderBy(l => l.StartTime);
|
||||
return commands;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
Loading…
Reference in New Issue
Block a user