mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Tidy up EditorBeatmap slightly
This commit is contained in:
parent
1027b608ff
commit
afed832b19
@ -182,7 +182,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
private void updatePath()
|
||||
{
|
||||
HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance;
|
||||
editorBeatmap?.UpdateHitObject(HitObject);
|
||||
editorBeatmap?.Update(HitObject);
|
||||
}
|
||||
|
||||
public override MenuItem[] ContextMenuItems => new MenuItem[]
|
||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
||||
if (h.IsStrong != state)
|
||||
{
|
||||
h.IsStrong = state;
|
||||
EditorBeatmap.UpdateHitObject(h);
|
||||
EditorBeatmap.Update(h);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
// handle positional change etc.
|
||||
foreach (var obj in selectedHitObjects)
|
||||
Beatmap.UpdateHitObject(obj);
|
||||
Beatmap.Update(obj);
|
||||
|
||||
changeHandler?.EndChange();
|
||||
isDraggingBlueprint = false;
|
||||
@ -440,7 +440,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
foreach (HitObject obj in SelectionHandler.SelectedHitObjects)
|
||||
{
|
||||
obj.StartTime += offset;
|
||||
Beatmap.UpdateHitObject(obj);
|
||||
Beatmap.Update(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
if (comboInfo == null || comboInfo.NewCombo == state) continue;
|
||||
|
||||
comboInfo.NewCombo = state;
|
||||
EditorBeatmap?.UpdateHitObject(h);
|
||||
EditorBeatmap?.Update(h);
|
||||
}
|
||||
|
||||
EditorBeatmap?.EndChange();
|
||||
|
@ -392,7 +392,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
return;
|
||||
|
||||
repeatHitObject.RepeatCount = proposedCount;
|
||||
beatmap.UpdateHitObject(hitObject);
|
||||
beatmap.Update(hitObject);
|
||||
break;
|
||||
|
||||
case IHasDuration endTimeHitObject:
|
||||
@ -402,7 +402,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
return;
|
||||
|
||||
endTimeHitObject.Duration = snappedTime - hitObject.StartTime;
|
||||
beatmap.UpdateHitObject(hitObject);
|
||||
beatmap.Update(hitObject);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,12 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private IList mutableHitObjects => (IList)PlayableBeatmap.HitObjects;
|
||||
|
||||
private readonly List<HitObject> batchPendingInserts = new List<HitObject>();
|
||||
|
||||
private readonly List<HitObject> batchPendingDeletes = new List<HitObject>();
|
||||
|
||||
private readonly HashSet<HitObject> batchPendingUpdates = new HashSet<HitObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a collection of <see cref="HitObject"/>s to this <see cref="EditorBeatmap"/>.
|
||||
/// </summary>
|
||||
@ -142,12 +148,21 @@ namespace osu.Game.Screens.Edit
|
||||
/// Updates a <see cref="HitObject"/>, invoking <see cref="HitObject.ApplyDefaults"/> and re-processing the beatmap.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> to update.</param>
|
||||
public void UpdateHitObject([NotNull] HitObject hitObject)
|
||||
public void Update([NotNull] HitObject hitObject)
|
||||
{
|
||||
// updates are debounced regardless of whether a batch is active.
|
||||
batchPendingUpdates.Add(hitObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update all hit objects with potentially changed difficulty or control point data.
|
||||
/// </summary>
|
||||
public void UpdateAllHitObjects()
|
||||
{
|
||||
foreach (var h in HitObjects)
|
||||
batchPendingUpdates.Add(h);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a <see cref="HitObject"/> from this <see cref="EditorBeatmap"/>.
|
||||
/// </summary>
|
||||
@ -210,12 +225,6 @@ namespace osu.Game.Screens.Edit
|
||||
}
|
||||
}
|
||||
|
||||
private readonly List<HitObject> batchPendingInserts = new List<HitObject>();
|
||||
|
||||
private readonly List<HitObject> batchPendingDeletes = new List<HitObject>();
|
||||
|
||||
private readonly HashSet<HitObject> batchPendingUpdates = new HashSet<HitObject>();
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
@ -270,7 +279,7 @@ namespace osu.Game.Screens.Edit
|
||||
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
||||
|
||||
UpdateHitObject(hitObject);
|
||||
Update(hitObject);
|
||||
};
|
||||
}
|
||||
|
||||
@ -296,14 +305,5 @@ namespace osu.Game.Screens.Edit
|
||||
public double GetBeatLengthAtTime(double referenceTime) => ControlPointInfo.TimingPointAt(referenceTime).BeatLength / BeatDivisor;
|
||||
|
||||
public int BeatDivisor => beatDivisor?.Value ?? 1;
|
||||
|
||||
/// <summary>
|
||||
/// Update all hit objects with potentially changed difficulty or control point data.
|
||||
/// </summary>
|
||||
public void UpdateAllHitObjects()
|
||||
{
|
||||
foreach (var h in HitObjects)
|
||||
batchPendingUpdates.Add(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user