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

Add the ability to save in the skin editor using system save hotkey

This commit is contained in:
Dean Herbert 2022-07-22 13:10:18 +09:00
parent 5db4d9437a
commit 92f59ce9a0

View File

@ -13,6 +13,8 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Database; using osu.Game.Database;
@ -27,7 +29,7 @@ using osu.Game.Screens.Edit.Components.Menus;
namespace osu.Game.Skinning.Editor namespace osu.Game.Skinning.Editor
{ {
[Cached(typeof(SkinEditor))] [Cached(typeof(SkinEditor))]
public class SkinEditor : VisibilityContainer, ICanAcceptFiles public class SkinEditor : VisibilityContainer, ICanAcceptFiles, IKeyBindingHandler<PlatformAction>
{ {
public const double TRANSITION_DURATION = 500; public const double TRANSITION_DURATION = 500;
@ -199,6 +201,25 @@ namespace osu.Game.Skinning.Editor
SelectedComponents.BindCollectionChanged((_, _) => Scheduler.AddOnce(populateSettings), true); SelectedComponents.BindCollectionChanged((_, _) => Scheduler.AddOnce(populateSettings), true);
} }
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
switch (e.Action)
{
case PlatformAction.Save:
if (e.Repeat)
return false;
Save();
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}
public void UpdateTargetScreen(Drawable targetScreen) public void UpdateTargetScreen(Drawable targetScreen)
{ {
this.targetScreen = targetScreen; this.targetScreen = targetScreen;