diff --git a/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs b/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs new file mode 100644 index 0000000000..9f55ce8ce5 --- /dev/null +++ b/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs @@ -0,0 +1,66 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Screens.Play.ReplaySettings; +using OpenTK; +using osu.Framework.Input; +using OpenTK.Input; + +namespace osu.Game.Screens.Play.HUD +{ + public class ReplaySettingsOverlay : VisibilityContainer + { + private const int fade_duration = 200; + + public override bool HandleInput => true; + + public readonly PlaybackSettings PlaybackSettings; + //public readonly CollectionSettings CollectionSettings; + //public readonly DiscussionSettings DiscussionSettings; + + public ReplaySettingsOverlay() + { + AlwaysPresent = true; + RelativeSizeAxes = Axes.Both; + + Child = new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 20), + Margin = new MarginPadding { Top = 100, Right = 10 }, + Children = new [] + { + //CollectionSettings = new CollectionSettings(), + //DiscussionSettings = new DiscussionSettings(), + PlaybackSettings = new PlaybackSettings(), + } + }; + + State = Visibility.Visible; + } + + protected override void PopIn() => this.FadeIn(fade_duration); + protected override void PopOut() => this.FadeOut(fade_duration); + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return false; + + if (state.Keyboard.ControlPressed) + { + if (args.Key == Key.H) + { + ToggleVisibility(); + return true; + } + } + + return base.OnKeyDown(state, args); + } + } +} diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index c632b7d893..1d7e0727ba 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -180,12 +180,7 @@ protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) Margin = new MarginPadding { Top = 20, Right = 10 }, }; - protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Margin = new MarginPadding { Top = 100, Right = 10 }, - }; + protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay(); public virtual void BindProcessor(ScoreProcessor processor) { diff --git a/osu.Game/Screens/Play/ReplaySettingsOverlay.cs b/osu.Game/Screens/Play/ReplaySettingsOverlay.cs deleted file mode 100644 index 0edf4634ba..0000000000 --- a/osu.Game/Screens/Play/ReplaySettingsOverlay.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Screens.Play.ReplaySettings; -using OpenTK; - -namespace osu.Game.Screens.Play -{ - public class ReplaySettingsOverlay : FillFlowContainer - { - public readonly PlaybackSettings PlaybackSettings; - - public ReplaySettingsOverlay() - { - Direction = FillDirection.Vertical; - AutoSizeAxes = Axes.Both; - Spacing = new Vector2(0, 20); - - //Add(new CollectionSettings()); - //Add(new DiscussionSettings()); - Add(PlaybackSettings = new PlaybackSettings()); - } - } -} diff --git a/osu.Game/Tests/Visual/TestCaseReplaySettingsOverlay.cs b/osu.Game/Tests/Visual/TestCaseReplaySettingsOverlay.cs index 256c3d25c9..3105a7d588 100644 --- a/osu.Game/Tests/Visual/TestCaseReplaySettingsOverlay.cs +++ b/osu.Game/Tests/Visual/TestCaseReplaySettingsOverlay.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Play; +using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.ReplaySettings; namespace osu.Game.Tests.Visual diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c8e42a3ad3..f04aa4708c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -656,7 +656,7 @@ - +