1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 03:02:56 +08:00

Change visibility on ctrl+h

This commit is contained in:
EVAST9919 2017-05-19 06:41:33 +03:00
parent e18f95185f
commit 91b081f0b2

View File

@ -2,12 +2,16 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK; using OpenTK;
using OpenTK.Input;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
namespace osu.Game.Screens.Play.Settings namespace osu.Game.Screens.Play.Settings
{ {
public class ReplaySettingsOverlay : FillFlowContainer public class ReplaySettingsOverlay : FillFlowContainer
{ {
private const int fade_duration = 100;
private bool isVisible; private bool isVisible;
public bool IsVisible public bool IsVisible
{ {
@ -16,15 +20,16 @@ namespace osu.Game.Screens.Play.Settings
isVisible = value; isVisible = value;
if (isVisible) if (isVisible)
Show(); FadeIn(fade_duration);
else else
Hide(); FadeOut(fade_duration);
} }
get { return isVisible; } get { return isVisible; }
} }
public ReplaySettingsOverlay() public ReplaySettingsOverlay()
{ {
AlwaysPresent = true;
Direction = FillDirection.Vertical; Direction = FillDirection.Vertical;
Spacing = new Vector2(0, 20); Spacing = new Vector2(0, 20);
@ -32,5 +37,22 @@ namespace osu.Game.Screens.Play.Settings
Add(new DiscussionSettings()); Add(new DiscussionSettings());
Add(new PlaybackSettings()); Add(new PlaybackSettings());
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Repeat) return false;
if (state.Keyboard.ControlPressed)
{
switch (args.Key)
{
case Key.H:
IsVisible = !isVisible;
return true;
}
}
return base.OnKeyDown(state, args);
}
} }
} }