mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Pass adjustable clocks to components, rather than relying on the track
This commit is contained in:
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -19,8 +20,12 @@ namespace osu.Game.Screens.Edit.Components
|
||||
{
|
||||
private readonly IconButton playButton;
|
||||
|
||||
public PlaybackControl()
|
||||
private readonly IAdjustableClock adjustableClock;
|
||||
|
||||
public PlaybackControl(IAdjustableClock adjustableClock)
|
||||
{
|
||||
this.adjustableClock = adjustableClock;
|
||||
|
||||
PlaybackTabControl tabs;
|
||||
|
||||
Children = new Drawable[]
|
||||
@ -54,22 +59,22 @@ namespace osu.Game.Screens.Edit.Components
|
||||
}
|
||||
};
|
||||
|
||||
tabs.Current.ValueChanged += newValue => Track.Tempo.Value = newValue;
|
||||
tabs.Current.ValueChanged += newValue => Beatmap.Value.Track.Tempo.Value = newValue;
|
||||
}
|
||||
|
||||
private void togglePause()
|
||||
{
|
||||
if (Track.IsRunning)
|
||||
Track.Stop();
|
||||
if (adjustableClock.IsRunning)
|
||||
adjustableClock.Stop();
|
||||
else
|
||||
Track.Start();
|
||||
adjustableClock.Start();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
playButton.Icon = Track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||
playButton.Icon = adjustableClock.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||
}
|
||||
|
||||
private class PlaybackTabControl : OsuTabControl<double>
|
||||
|
Reference in New Issue
Block a user