Hide/Show Replay settings on pressing Ctrl+H

This commit is contained in:
EVAST9919 2017-10-02 19:33:58 +03:00
parent 4a298098c5
commit b94c78e993
5 changed files with 69 additions and 34 deletions

View File

@ -0,0 +1,66 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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<ReplayGroup>
{
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);
}
}
}

View File

@ -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)
{

View File

@ -1,26 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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());
}
}
}

View File

@ -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

View File

@ -656,7 +656,7 @@
<Compile Include="Screens\Play\Player.cs" />
<Compile Include="Screens\Play\PlayerLoader.cs" />
<Compile Include="Screens\Play\ReplayPlayer.cs" />
<Compile Include="Screens\Play\ReplaySettingsOverlay.cs" />
<Compile Include="Screens\Play\HUD\ReplaySettingsOverlay.cs" />
<Compile Include="Screens\Play\ReplaySettings\CollectionSettings.cs" />
<Compile Include="Screens\Play\ReplaySettings\DiscussionSettings.cs" />
<Compile Include="Screens\Play\ReplaySettings\PlaybackSettings.cs" />