Fix editor timing screen mutating the WorkingBeatmap instead of EditorBeatmap

This commit is contained in:
Dean Herbert
2021-01-04 16:38:15 +09:00
parent b4a779108e
commit 7fdf876b4c
7 changed files with 14 additions and 17 deletions

View File

@ -7,7 +7,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
@ -62,7 +61,7 @@ namespace osu.Game.Screens.Edit.Timing
private EditorClock clock { get; set; }
[Resolved]
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
protected EditorBeatmap Beatmap { get; private set; }
[Resolved]
private Bindable<ControlPointGroup> selectedGroup { get; set; }
@ -124,7 +123,7 @@ namespace osu.Game.Screens.Edit.Timing
selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
controlPointGroups.BindTo(Beatmap.Value.Beatmap.ControlPointInfo.Groups);
controlPointGroups.BindTo(Beatmap.ControlPointInfo.Groups);
controlPointGroups.BindCollectionChanged((sender, args) =>
{
table.ControlGroups = controlPointGroups;
@ -137,14 +136,14 @@ namespace osu.Game.Screens.Edit.Timing
if (selectedGroup.Value == null)
return;
Beatmap.Value.Beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value);
Beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value);
selectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.Groups.FirstOrDefault(g => g.Time >= clock.CurrentTime);
selectedGroup.Value = Beatmap.ControlPointInfo.Groups.FirstOrDefault(g => g.Time >= clock.CurrentTime);
}
private void addNew()
{
selectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.GroupAt(clock.CurrentTime, true);
selectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(clock.CurrentTime, true);
}
}
}