1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 15:02:54 +08:00

use RepeatingButtonBehavior for seek buttons

This commit is contained in:
Nitrous 2024-01-09 16:08:29 +08:00
parent bdecac6d79
commit 63961ea276
No known key found for this signature in database
GPG Key ID: A5D82BAEC7C1D1F5

View File

@ -11,6 +11,7 @@ using osu.Game.Beatmaps;
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;
using osu.Game.Screens.Edit.Timing;
using osuTK; using osuTK;
namespace osu.Game.Screens.Play.PlayerSettings namespace osu.Game.Screens.Play.PlayerSettings
@ -64,14 +65,14 @@ namespace osu.Game.Screens.Play.PlayerSettings
Spacing = new Vector2(5, 0), Spacing = new Vector2(5, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
new IconButton new SeekButton
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Icon = FontAwesome.Solid.FastBackward, Icon = FontAwesome.Solid.FastBackward,
Action = () => seek(-1, seek_fast_amount), Action = () => seek(-1, seek_fast_amount),
}, },
new IconButton new SeekButton
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -96,14 +97,14 @@ namespace osu.Game.Screens.Play.PlayerSettings
} }
} }
}, },
new IconButton new SeekButton
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Forward, Icon = FontAwesome.Solid.Forward,
Action = () => seek(1, seek_amount), Action = () => seek(1, seek_amount),
}, },
new IconButton new SeekButton
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -151,5 +152,13 @@ namespace osu.Game.Screens.Play.PlayerSettings
rateSlider.Current.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true); rateSlider.Current.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true);
gameplayClock?.IsPaused.BindTo(isPaused); gameplayClock?.IsPaused.BindTo(isPaused);
} }
private partial class SeekButton : IconButton
{
public SeekButton()
{
AddInternal(new RepeatingButtonBehaviour(this));
}
}
} }
} }