mirror of
https://github.com/ppy/osu.git
synced 2025-01-25 15:42:55 +08:00
Moved setting to the menu bar
This commit is contained in:
parent
559f94aa02
commit
ac0c425e29
@ -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))
|
||||
{
|
||||
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)
|
||||
hitObjectWithDuration.Duration *= newBeatLength / BeatLength;
|
||||
hitObjectWithDuration.Duration *= BeatLength / oldBeatLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
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>
|
||||
/// "For editing (.olz)"
|
||||
/// </summary>
|
||||
|
@ -367,7 +367,11 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
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 },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,8 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
public BindableInt PreviewTime { get; }
|
||||
|
||||
public Bindable<bool> AdjustNotesOnOffsetBPMChange { get; } = new Bindable<bool>(false);
|
||||
|
||||
private readonly IBeatmapProcessor beatmapProcessor;
|
||||
|
||||
private readonly Dictionary<HitObject, Bindable<double>> startTimeBindables = new Dictionary<HitObject, Bindable<double>>();
|
||||
|
@ -37,8 +37,6 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
private MetronomeDisplay metronome = null!;
|
||||
|
||||
private LabelledSwitchButton adjustPlacedNotes = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
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, 50),
|
||||
new Dimension(GridSizeMode.Absolute, 50),
|
||||
new Dimension(GridSizeMode.Absolute, TapButton.SIZE + padding),
|
||||
},
|
||||
Content = new[]
|
||||
@ -123,18 +120,6 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
},
|
||||
},
|
||||
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
|
||||
{
|
||||
@ -227,7 +212,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
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);
|
||||
beatmap.ControlPointInfo.Add(newOffset, cp);
|
||||
}
|
||||
@ -249,12 +234,10 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
if (timing == null)
|
||||
return;
|
||||
|
||||
double newBeatLength = 60000 / (timing.BPM + adjust);
|
||||
timing.BeatLength = 60000 / (timing.BPM + adjust);
|
||||
|
||||
if (adjustPlacedNotes.Current.Value)
|
||||
timing.SetHitObjectBPM(beatmap, newBeatLength);
|
||||
|
||||
timing.BeatLength = newBeatLength;
|
||||
if (beatmap.AdjustNotesOnOffsetBPMChange.Value)
|
||||
timing.SetHitObjectBPM(beatmap, 60000 / (timing.BPM - adjust));
|
||||
|
||||
beatmap.UpdateAllHitObjects();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user