1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 17:32:54 +08:00

Fix editor rate adjustment polluting global beatmap rate

This commit is contained in:
Dean Herbert 2020-01-24 13:10:02 +09:00
parent 8122bdf2d8
commit e4702ffe9e
2 changed files with 15 additions and 11 deletions

View File

@ -5,6 +5,8 @@ using System.Linq;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -25,13 +27,13 @@ namespace osu.Game.Screens.Edit.Components
private IAdjustableClock adjustableClock;
private readonly BindableNumber<double> tempo = new BindableDouble(1);
[BackgroundDependencyLoader]
private void load(IAdjustableClock adjustableClock)
{
this.adjustableClock = adjustableClock;
PlaybackTabControl tabs;
Children = new Drawable[]
{
playButton = new IconButton
@ -58,11 +60,18 @@ namespace osu.Game.Screens.Edit.Components
RelativeSizeAxes = Axes.Both,
Height = 0.5f,
Padding = new MarginPadding { Left = 45 },
Child = tabs = new PlaybackTabControl(),
Child = new PlaybackTabControl { Current = tempo },
}
};
tabs.Current.ValueChanged += tempo => Beatmap.Value.Track.Tempo.Value = tempo.NewValue;
Track?.AddAdjustment(AdjustableProperty.Tempo, tempo);
}
protected override void Dispose(bool isDisposing)
{
Track?.RemoveAdjustment(AdjustableProperty.Tempo, tempo);
base.Dispose(isDisposing);
}
protected override bool OnKeyDown(KeyDownEvent e)

View File

@ -46,6 +46,8 @@ namespace osu.Game.Screens.Edit
public override bool DisallowExternalBeatmapRulesetChanges => true;
public override bool AllowRateAdjustments => false;
[Resolved]
private BeatmapManager beatmapManager { get; set; }
@ -262,12 +264,6 @@ namespace osu.Game.Screens.Edit
{
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
Beatmap.Value.Track?.Stop();
}
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
@ -291,7 +287,6 @@ namespace osu.Game.Screens.Edit
private void resetTrack(bool seekToStart = false)
{
Beatmap.Value.Track?.ResetSpeedAdjustments();
Beatmap.Value.Track?.Stop();
if (seekToStart)