1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 21:42:56 +08:00

Moved setting to the menu bar

This commit is contained in:
Aurelian 2024-06-09 11:27:53 +02:00
parent 559f94aa02
commit ac0c425e29
5 changed files with 20 additions and 26 deletions

View File

@ -128,16 +128,16 @@ namespace osu.Game.Beatmaps.ControlPoints
} }
} }
public void SetHitObjectBPM(IBeatmap beatmap, double newBeatLength) public void SetHitObjectBPM(IBeatmap beatmap, double oldBeatLength)
{ {
foreach (HitObject hitObject in HitObjectsInTimingRange(beatmap)) foreach (HitObject hitObject in HitObjectsInTimingRange(beatmap))
{ {
double beat = (hitObject.StartTime - Time) / BeatLength; double beat = (hitObject.StartTime - Time) / oldBeatLength;
hitObject.StartTime = (beat * newBeatLength) + Time; hitObject.StartTime = (beat * BeatLength) + Time;
if (hitObject is not IHasRepeats && hitObject is IHasDuration hitObjectWithDuration) if (hitObject is not IHasRepeats && hitObject is IHasDuration hitObjectWithDuration)
hitObjectWithDuration.Duration *= newBeatLength / BeatLength; hitObjectWithDuration.Duration *= BeatLength / oldBeatLength;
} }
} }
} }

View File

@ -39,6 +39,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString SetPreviewPointToCurrent => new TranslatableString(getKey(@"set_preview_point_to_current"), @"Set preview point to current time"); public static LocalisableString SetPreviewPointToCurrent => new TranslatableString(getKey(@"set_preview_point_to_current"), @"Set preview point to current time");
/// <summary>
/// "Move already placed notes when changing the offset / BPM"
/// </summary>
public static LocalisableString AdjustNotesOnOffsetBPMChange => new TranslatableString(getKey(@"adjust_notes_on_offset_bpm_change"), @"Move already placed notes when changing the offset / BPM");
/// <summary> /// <summary>
/// "For editing (.olz)" /// "For editing (.olz)"
/// </summary> /// </summary>

View File

@ -367,7 +367,11 @@ namespace osu.Game.Screens.Edit
{ {
Items = new MenuItem[] Items = new MenuItem[]
{ {
new EditorMenuItem(EditorStrings.SetPreviewPointToCurrent, MenuItemType.Standard, SetPreviewPointToCurrentTime) new EditorMenuItem(EditorStrings.SetPreviewPointToCurrent, MenuItemType.Standard, SetPreviewPointToCurrentTime),
new ToggleMenuItem(EditorStrings.AdjustNotesOnOffsetBPMChange)
{
State = { BindTarget = editorBeatmap.AdjustNotesOnOffsetBPMChange },
}
} }
} }
} }

View File

@ -88,6 +88,8 @@ namespace osu.Game.Screens.Edit
public BindableInt PreviewTime { get; } public BindableInt PreviewTime { get; }
public Bindable<bool> AdjustNotesOnOffsetBPMChange { get; } = new Bindable<bool>(false);
private readonly IBeatmapProcessor beatmapProcessor; private readonly IBeatmapProcessor beatmapProcessor;
private readonly Dictionary<HitObject, Bindable<double>> startTimeBindables = new Dictionary<HitObject, Bindable<double>>(); private readonly Dictionary<HitObject, Bindable<double>> startTimeBindables = new Dictionary<HitObject, Bindable<double>>();

View File

@ -37,8 +37,6 @@ namespace osu.Game.Screens.Edit.Timing
private MetronomeDisplay metronome = null!; private MetronomeDisplay metronome = null!;
private LabelledSwitchButton adjustPlacedNotes = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours) private void load(OverlayColourProvider colourProvider, OsuColour colours)
{ {
@ -65,7 +63,6 @@ namespace osu.Game.Screens.Edit.Timing
{ {
new Dimension(GridSizeMode.Absolute, 200), new Dimension(GridSizeMode.Absolute, 200),
new Dimension(GridSizeMode.Absolute, 50), new Dimension(GridSizeMode.Absolute, 50),
new Dimension(GridSizeMode.Absolute, 50),
new Dimension(GridSizeMode.Absolute, TapButton.SIZE + padding), new Dimension(GridSizeMode.Absolute, TapButton.SIZE + padding),
}, },
Content = new[] Content = new[]
@ -123,18 +120,6 @@ namespace osu.Game.Screens.Edit.Timing
}, },
}, },
new Drawable[] new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Bottom = padding, Horizontal = padding },
Children = new Drawable[]
{
adjustPlacedNotes = new LabelledSwitchButton { Label = "Move already placed notes\nwhen changing the offset/BPM" },
}
},
},
new Drawable[]
{ {
new Container new Container
{ {
@ -227,7 +212,7 @@ namespace osu.Game.Screens.Edit.Timing
foreach (var cp in currentGroupItems) foreach (var cp in currentGroupItems)
{ {
if (adjustPlacedNotes.Current.Value && cp is TimingControlPoint tp) if (beatmap.AdjustNotesOnOffsetBPMChange.Value && cp is TimingControlPoint tp)
tp.AdjustHitObjectOffset(beatmap, adjust); tp.AdjustHitObjectOffset(beatmap, adjust);
beatmap.ControlPointInfo.Add(newOffset, cp); beatmap.ControlPointInfo.Add(newOffset, cp);
} }
@ -249,12 +234,10 @@ namespace osu.Game.Screens.Edit.Timing
if (timing == null) if (timing == null)
return; return;
double newBeatLength = 60000 / (timing.BPM + adjust); timing.BeatLength = 60000 / (timing.BPM + adjust);
if (adjustPlacedNotes.Current.Value) if (beatmap.AdjustNotesOnOffsetBPMChange.Value)
timing.SetHitObjectBPM(beatmap, newBeatLength); timing.SetHitObjectBPM(beatmap, 60000 / (timing.BPM - adjust));
timing.BeatLength = newBeatLength;
beatmap.UpdateAllHitObjects(); beatmap.UpdateAllHitObjects();
} }