1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 13:22:55 +08:00

Add OnPressed to button

This commit is contained in:
maromalo 2022-05-21 04:55:42 -03:00
parent 6994b8d392
commit a7aa36a825

View File

@ -15,9 +15,12 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Screens;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Input.Bindings;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
@ -473,8 +476,19 @@ namespace osu.Game.Screens.OnlinePlay.Match
/// <param name="room">The room to change the settings of.</param>
protected abstract RoomSettingsOverlay CreateRoomSettingsOverlay(Room room);
public class UserModSelectButton : PurpleTriangleButton
public class UserModSelectButton : PurpleTriangleButton, IKeyBindingHandler<GlobalAction>
{
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Action == GlobalAction.ToggleModSelection && !e.Repeat)
{
TriggerClick();
return true;
}
return false;
}
public virtual void OnReleased(KeyBindingReleaseEvent<GlobalAction> e) { }
}
protected override void Dispose(bool isDisposing)