Merge pull request #7594 from peppy/fix-editor-rate-pollution

Fix editor rate adjustment polluting global beatmap rate
This commit is contained in:
Dan Balasescu 2020-01-24 13:36:47 +09:00 committed by GitHub
commit 9f8e3c21e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)