mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +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()
|
private void updatePath()
|
||||||
{
|
{
|
||||||
HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance;
|
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[]
|
public override MenuItem[] ContextMenuItems => new MenuItem[]
|
||||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
|||||||
if (h.IsStrong != state)
|
if (h.IsStrong != state)
|
||||||
{
|
{
|
||||||
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.
|
// handle positional change etc.
|
||||||
foreach (var obj in selectedHitObjects)
|
foreach (var obj in selectedHitObjects)
|
||||||
Beatmap.UpdateHitObject(obj);
|
Beatmap.Update(obj);
|
||||||
|
|
||||||
changeHandler?.EndChange();
|
changeHandler?.EndChange();
|
||||||
isDraggingBlueprint = false;
|
isDraggingBlueprint = false;
|
||||||
@ -440,7 +440,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
foreach (HitObject obj in SelectionHandler.SelectedHitObjects)
|
foreach (HitObject obj in SelectionHandler.SelectedHitObjects)
|
||||||
{
|
{
|
||||||
obj.StartTime += offset;
|
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;
|
if (comboInfo == null || comboInfo.NewCombo == state) continue;
|
||||||
|
|
||||||
comboInfo.NewCombo = state;
|
comboInfo.NewCombo = state;
|
||||||
EditorBeatmap?.UpdateHitObject(h);
|
EditorBeatmap?.Update(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorBeatmap?.EndChange();
|
EditorBeatmap?.EndChange();
|
||||||
|
@ -392,7 +392,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
repeatHitObject.RepeatCount = proposedCount;
|
repeatHitObject.RepeatCount = proposedCount;
|
||||||
beatmap.UpdateHitObject(hitObject);
|
beatmap.Update(hitObject);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IHasDuration endTimeHitObject:
|
case IHasDuration endTimeHitObject:
|
||||||
@ -402,7 +402,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
endTimeHitObject.Duration = snappedTime - hitObject.StartTime;
|
endTimeHitObject.Duration = snappedTime - hitObject.StartTime;
|
||||||
beatmap.UpdateHitObject(hitObject);
|
beatmap.Update(hitObject);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,12 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private IList mutableHitObjects => (IList)PlayableBeatmap.HitObjects;
|
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>
|
/// <summary>
|
||||||
/// Adds a collection of <see cref="HitObject"/>s to this <see cref="EditorBeatmap"/>.
|
/// Adds a collection of <see cref="HitObject"/>s to this <see cref="EditorBeatmap"/>.
|
||||||
/// </summary>
|
/// </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.
|
/// Updates a <see cref="HitObject"/>, invoking <see cref="HitObject.ApplyDefaults"/> and re-processing the beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The <see cref="HitObject"/> to update.</param>
|
/// <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.
|
// updates are debounced regardless of whether a batch is active.
|
||||||
batchPendingUpdates.Add(hitObject);
|
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>
|
/// <summary>
|
||||||
/// Removes a <see cref="HitObject"/> from this <see cref="EditorBeatmap"/>.
|
/// Removes a <see cref="HitObject"/> from this <see cref="EditorBeatmap"/>.
|
||||||
/// </summary>
|
/// </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()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
@ -270,7 +279,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||||
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
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 double GetBeatLengthAtTime(double referenceTime) => ControlPointInfo.TimingPointAt(referenceTime).BeatLength / BeatDivisor;
|
||||||
|
|
||||||
public int BeatDivisor => beatDivisor?.Value ?? 1;
|
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