mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Merge pull request #9285 from Joehuu/home-shortcut
Add shortcut to go home
This commit is contained in:
commit
7e206ad2bd
@ -39,6 +39,8 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(InputKey.Escape, GlobalAction.Back),
|
||||
new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
|
||||
|
||||
new KeyBinding(new[] { InputKey.Alt, InputKey.Home }, GlobalAction.Home),
|
||||
|
||||
new KeyBinding(InputKey.Up, GlobalAction.SelectPrevious),
|
||||
new KeyBinding(InputKey.Down, GlobalAction.SelectNext),
|
||||
|
||||
@ -152,5 +154,8 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[Description("Next Selection")]
|
||||
SelectNext,
|
||||
|
||||
[Description("Home")]
|
||||
Home,
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
protected ConstrainedIconContainer IconContainer;
|
||||
protected SpriteText DrawableText;
|
||||
protected Box HoverBackground;
|
||||
private readonly Box flashBackground;
|
||||
private readonly FillFlowContainer tooltipContainer;
|
||||
private readonly SpriteText tooltip1;
|
||||
private readonly SpriteText tooltip2;
|
||||
@ -82,6 +83,13 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Blending = BlendingParameters.Additive,
|
||||
Alpha = 0,
|
||||
},
|
||||
flashBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
Colour = Color4.White.Opacity(100),
|
||||
Blending = BlendingParameters.Additive,
|
||||
},
|
||||
Flow = new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Horizontal,
|
||||
@ -139,7 +147,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
HoverBackground.FlashColour(Color4.White.Opacity(100), 500, Easing.OutQuint);
|
||||
flashBackground.FadeOutFromOne(800, Easing.OutQuint);
|
||||
tooltipContainer.FadeOut(100);
|
||||
return base.OnClick(e);
|
||||
}
|
||||
|
@ -2,10 +2,12 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class ToolbarHomeButton : ToolbarButton
|
||||
public class ToolbarHomeButton : ToolbarButton, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public ToolbarHomeButton()
|
||||
{
|
||||
@ -13,5 +15,20 @@ namespace osu.Game.Overlays.Toolbar
|
||||
TooltipMain = "Home";
|
||||
TooltipSub = "Return to the main menu";
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
if (action == GlobalAction.Home)
|
||||
{
|
||||
Click();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnReleased(GlobalAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user