From 15cd4f77b2eb40506f985860d18c5084e2f74efd Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 23 Jun 2017 22:35:06 -0300 Subject: [PATCH] Proper dismissing. --- osu.Game/Overlays/MedalOverlay.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 2d2a32fa4f..a796da82b9 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -19,6 +19,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK.Input; +using System.Linq; namespace osu.Game.Overlays { @@ -37,7 +38,16 @@ namespace osu.Game.Overlays private SampleChannel getSample; - protected override bool BlockPassThroughKeyboard => true; + protected override bool OnClick(InputState state) + { + dismiss(); + return true; + } + + protected override void OnFocusLost(InputState state) + { + if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); + } public MedalOverlay(Medal medal) { @@ -189,6 +199,12 @@ namespace osu.Game.Overlays FadeOut(200); } + private void dismiss() + { + if (drawableMedal.Transforms.Count != 0) return; + Hide(); + } + private class BackgroundStrip : Container { public BackgroundStrip(float start, float end)