mirror of
https://github.com/ppy/osu
synced 2024-12-16 20:05:41 +00:00
Merge pull request #28521 from bdach/tempo-adjust-editor
Change editor speed adjustment back to adjusting tempo
This commit is contained in:
commit
a4c575f77a
@ -10,9 +10,11 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -25,14 +27,16 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
public partial class PlaybackControl : BottomBarContainer
|
public partial class PlaybackControl : BottomBarContainer
|
||||||
{
|
{
|
||||||
private IconButton playButton = null!;
|
private IconButton playButton = null!;
|
||||||
|
private PlaybackSpeedControl playbackSpeedControl = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorClock editorClock { get; set; } = null!;
|
private EditorClock editorClock { get; set; } = null!;
|
||||||
|
|
||||||
private readonly BindableNumber<double> freqAdjust = new BindableDouble(1);
|
private readonly Bindable<EditorScreenMode> currentScreenMode = new Bindable<EditorScreenMode>();
|
||||||
|
private readonly BindableNumber<double> tempoAdjustment = new BindableDouble(1);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider, Editor? editor)
|
||||||
{
|
{
|
||||||
Background.Colour = colourProvider.Background4;
|
Background.Colour = colourProvider.Background4;
|
||||||
|
|
||||||
@ -47,31 +51,61 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
Icon = FontAwesome.Regular.PlayCircle,
|
Icon = FontAwesome.Regular.PlayCircle,
|
||||||
Action = togglePause,
|
Action = togglePause,
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
playbackSpeedControl = new PlaybackSpeedControl
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomLeft,
|
AutoSizeAxes = Axes.Y,
|
||||||
Text = EditorStrings.PlaybackSpeed,
|
RelativeSizeAxes = Axes.X,
|
||||||
RelativePositionAxes = Axes.Y,
|
Padding = new MarginPadding { Left = 45, },
|
||||||
Y = 0.5f,
|
Anchor = Anchor.CentreRight,
|
||||||
Padding = new MarginPadding { Left = 45 }
|
Origin = Anchor.CentreRight,
|
||||||
},
|
Direction = FillDirection.Vertical,
|
||||||
new Container
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
new OsuSpriteText
|
||||||
Origin = Anchor.BottomLeft,
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
Text = EditorStrings.PlaybackSpeed,
|
||||||
Height = 0.5f,
|
},
|
||||||
Padding = new MarginPadding { Left = 45 },
|
new PlaybackTabControl
|
||||||
Child = new PlaybackTabControl { Current = freqAdjust },
|
{
|
||||||
|
Current = tempoAdjustment,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 16,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Track.BindValueChanged(tr => tr.NewValue?.AddAdjustment(AdjustableProperty.Frequency, freqAdjust), true);
|
Track.BindValueChanged(tr => tr.NewValue?.AddAdjustment(AdjustableProperty.Tempo, tempoAdjustment), true);
|
||||||
|
|
||||||
|
if (editor != null)
|
||||||
|
currentScreenMode.BindTo(editor.Mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
currentScreenMode.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
if (currentScreenMode.Value == EditorScreenMode.Timing)
|
||||||
|
{
|
||||||
|
tempoAdjustment.Value = 1;
|
||||||
|
tempoAdjustment.Disabled = true;
|
||||||
|
playbackSpeedControl.FadeTo(0.5f, 400, Easing.OutQuint);
|
||||||
|
playbackSpeedControl.TooltipText = "Speed adjustment is unavailable in timing mode. Timing at slower speeds is inaccurate due to resampling artifacts.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempoAdjustment.Disabled = false;
|
||||||
|
playbackSpeedControl.FadeTo(1, 400, Easing.OutQuint);
|
||||||
|
playbackSpeedControl.TooltipText = default;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
Track.Value?.RemoveAdjustment(AdjustableProperty.Frequency, freqAdjust);
|
Track.Value?.RemoveAdjustment(AdjustableProperty.Frequency, tempoAdjustment);
|
||||||
|
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
@ -109,6 +143,11 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
playButton.Icon = editorClock.IsRunning ? pause_icon : play_icon;
|
playButton.Icon = editorClock.IsRunning ? pause_icon : play_icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private partial class PlaybackSpeedControl : FillFlowContainer, IHasTooltip
|
||||||
|
{
|
||||||
|
public LocalisableString TooltipText { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
private partial class PlaybackTabControl : OsuTabControl<double>
|
private partial class PlaybackTabControl : OsuTabControl<double>
|
||||||
{
|
{
|
||||||
private static readonly double[] tempo_values = { 0.25, 0.5, 0.75, 1 };
|
private static readonly double[] tempo_values = { 0.25, 0.5, 0.75, 1 };
|
||||||
@ -174,7 +213,7 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
updateState();
|
updateState();
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e) => updateState();
|
protected override void OnHoverLost(HoverLostEvent e) => updateState();
|
||||||
|
Loading…
Reference in New Issue
Block a user