1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-13 00:47:19 +08:00

Handle SelectPrevious/SelectNext locally to volume meter when hovered

This commit is contained in:
Dean Herbert 2020-03-02 18:59:55 +09:00
parent e608d807f4
commit 81191a3d20

View File

@ -11,16 +11,18 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Overlays.Volume namespace osu.Game.Overlays.Volume
{ {
public class VolumeMeter : Container public class VolumeMeter : Container, IKeyBindingHandler<GlobalAction>
{ {
private CircularProgress volumeCircle; private CircularProgress volumeCircle;
private CircularProgress volumeCircleGlow; private CircularProgress volumeCircleGlow;
@ -260,5 +262,28 @@ namespace osu.Game.Overlays.Volume
{ {
this.ScaleTo(1f, transition_length, Easing.OutExpo); this.ScaleTo(1f, transition_length, Easing.OutExpo);
} }
public bool OnPressed(GlobalAction action)
{
if (!IsHovered)
return false;
switch (action)
{
case GlobalAction.SelectPrevious:
adjust(1, false);
return true;
case GlobalAction.SelectNext:
adjust(-1, false);
return true;
}
return false;
}
public void OnReleased(GlobalAction action)
{
}
} }
} }