1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 17:52:56 +08:00

Update usages of ChangeHandler to EditorBeatmap where relevant

This commit is contained in:
Dean Herbert 2020-10-08 17:43:27 +09:00
parent 7ffab38728
commit 38babf3de5
3 changed files with 12 additions and 14 deletions

View File

@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Taiko.Edit
{
var hits = SelectedHitObjects.OfType<Hit>();
ChangeHandler.BeginChange();
EditorBeatmap.BeginChange();
foreach (var h in hits)
{
@ -65,19 +65,19 @@ namespace osu.Game.Rulesets.Taiko.Edit
}
}
ChangeHandler.EndChange();
EditorBeatmap.EndChange();
}
public void SetRimState(bool state)
{
var hits = SelectedHitObjects.OfType<Hit>();
ChangeHandler.BeginChange();
EditorBeatmap.BeginChange();
foreach (var h in hits)
h.Type = state ? HitType.Rim : HitType.Centre;
ChangeHandler.EndChange();
EditorBeatmap.EndChange();
}
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint> selection)

View File

@ -238,9 +238,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void deleteSelected()
{
ChangeHandler?.BeginChange();
EditorBeatmap?.RemoveRange(selectedBlueprints.Select(b => b.HitObject));
ChangeHandler?.EndChange();
}
#endregion
@ -307,7 +305,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="sampleName">The name of the hit sample.</param>
public void AddHitSample(string sampleName)
{
ChangeHandler?.BeginChange();
EditorBeatmap?.BeginChange();
foreach (var h in SelectedHitObjects)
{
@ -318,7 +316,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
h.Samples.Add(new HitSampleInfo { Name = sampleName });
}
ChangeHandler?.EndChange();
EditorBeatmap?.EndChange();
}
/// <summary>
@ -328,7 +326,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <exception cref="InvalidOperationException">Throws if any selected object doesn't implement <see cref="IHasComboInformation"/></exception>
public void SetNewCombo(bool state)
{
ChangeHandler?.BeginChange();
EditorBeatmap?.BeginChange();
foreach (var h in SelectedHitObjects)
{
@ -340,7 +338,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
EditorBeatmap?.UpdateHitObject(h);
}
ChangeHandler?.EndChange();
EditorBeatmap?.EndChange();
}
/// <summary>
@ -349,12 +347,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="sampleName">The name of the hit sample.</param>
public void RemoveHitSample(string sampleName)
{
ChangeHandler?.BeginChange();
EditorBeatmap?.BeginChange();
foreach (var h in SelectedHitObjects)
h.SamplesBindable.RemoveAll(s => s.Name == sampleName);
ChangeHandler?.EndChange();
EditorBeatmap?.EndChange();
}
#endregion

View File

@ -509,14 +509,14 @@ namespace osu.Game.Screens.Edit
foreach (var h in objects)
h.StartTime += timeOffset;
changeHandler.BeginChange();
editorBeatmap.BeginChange();
editorBeatmap.SelectedHitObjects.Clear();
editorBeatmap.AddRange(objects);
editorBeatmap.SelectedHitObjects.AddRange(objects);
changeHandler.EndChange();
editorBeatmap.EndChange();
}
protected void Undo() => changeHandler.RestoreState(-1);