mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Add back reorder support
This commit is contained in:
parent
17ff7fe163
commit
2fc53a278d
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -27,6 +28,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
|
||||
private readonly List<FollowPointLifetimeEntry> lifetimeEntries = new List<FollowPointLifetimeEntry>();
|
||||
private readonly Dictionary<LifetimeEntry, FollowPointConnection> connectionsInUse = new Dictionary<LifetimeEntry, FollowPointConnection>();
|
||||
private readonly Dictionary<HitObject, IBindable> startTimeMap = new Dictionary<HitObject, IBindable>();
|
||||
private readonly LifetimeEntryManager lifetimeManager = new LifetimeEntryManager();
|
||||
|
||||
public FollowPointRenderer()
|
||||
@ -49,6 +51,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
}
|
||||
|
||||
public void AddFollowPoints2(OsuHitObject hitObject)
|
||||
{
|
||||
addEntry(hitObject);
|
||||
|
||||
var startTimeBindable = hitObject.StartTimeBindable.GetBoundCopy();
|
||||
startTimeBindable.ValueChanged += _ => onStartTimeChanged(hitObject);
|
||||
startTimeMap[hitObject] = startTimeBindable;
|
||||
}
|
||||
|
||||
public void RemoveFollowPoints2(OsuHitObject hitObject)
|
||||
{
|
||||
removeEntry(hitObject);
|
||||
|
||||
startTimeMap[hitObject].UnbindAll();
|
||||
startTimeMap.Remove(hitObject);
|
||||
}
|
||||
|
||||
private void addEntry(OsuHitObject hitObject)
|
||||
{
|
||||
var newEntry = new FollowPointLifetimeEntry(hitObject);
|
||||
|
||||
@ -95,7 +114,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
lifetimeManager.AddEntry(newEntry);
|
||||
}
|
||||
|
||||
public void RemoveFollowPoints2(OsuHitObject hitObject)
|
||||
private void removeEntry(OsuHitObject hitObject)
|
||||
{
|
||||
int index = lifetimeEntries.FindIndex(e => e.Start == hitObject);
|
||||
var entry = lifetimeEntries[index];
|
||||
@ -136,6 +155,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
connectionsInUse.Remove(entry);
|
||||
}
|
||||
|
||||
private void onStartTimeChanged(OsuHitObject hitObject)
|
||||
{
|
||||
removeEntry(hitObject);
|
||||
addEntry(hitObject);
|
||||
}
|
||||
|
||||
public class FollowPointLifetimeEntry : LifetimeEntry
|
||||
{
|
||||
public readonly OsuHitObject Start;
|
||||
|
Loading…
Reference in New Issue
Block a user