Allow saving changes in tournament system using `Ctrl`+`S`

This commit is contained in:
Dean Herbert 2023-08-30 13:29:08 +09:00
parent d3e40f89e2
commit a85f0d5791
1 changed files with 19 additions and 1 deletions

View File

@ -7,13 +7,16 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Online.Multiplayer;
using osuTK;
namespace osu.Game.Tournament
{
internal partial class SaveChangesOverlay : CompositeDrawable
internal partial class SaveChangesOverlay : CompositeDrawable, IKeyBindingHandler<PlatformAction>
{
[Resolved]
private TournamentGame tournamentGame { get; set; } = null!;
@ -78,6 +81,21 @@ private async Task checkForChanges()
scheduleNextCheck();
}
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
if (e.Action == PlatformAction.Save && !e.Repeat)
{
saveChangesButton.TriggerClick();
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}
private void scheduleNextCheck() => Scheduler.AddDelayed(() => checkForChanges().FireAndForget(), 1000);
private void saveChanges()