2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-10-03 00:33:58 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-10-02 11:02:47 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
2018-01-14 03:25:09 +08:00
|
|
|
|
using osu.Game.Screens.Play.PlayerSettings;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK.Input;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-10-03 00:33:58 +08:00
|
|
|
|
namespace osu.Game.Screens.Play.HUD
|
|
|
|
|
{
|
2018-01-14 03:25:09 +08:00
|
|
|
|
public partial class PlayerSettingsOverlay : VisibilityContainer
|
2017-10-03 00:33:58 +08:00
|
|
|
|
{
|
|
|
|
|
private const int fade_duration = 200;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-10-04 01:26:53 +08:00
|
|
|
|
public bool ReplayLoaded;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-10-03 00:33:58 +08:00
|
|
|
|
public readonly PlaybackSettings PlaybackSettings;
|
2019-02-28 12:31:40 +08:00
|
|
|
|
|
2018-01-10 07:24:51 +08:00
|
|
|
|
public readonly VisualSettings VisualSettings;
|
2019-03-06 19:30:14 +08:00
|
|
|
|
|
2018-01-14 03:25:09 +08:00
|
|
|
|
public PlayerSettingsOverlay()
|
2017-10-03 00:33:58 +08:00
|
|
|
|
{
|
|
|
|
|
AlwaysPresent = true;
|
2020-10-15 16:11:02 +08:00
|
|
|
|
|
|
|
|
|
Anchor = Anchor.TopRight;
|
|
|
|
|
Origin = Anchor.TopRight;
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-01-16 01:52:52 +08:00
|
|
|
|
Child = new FillFlowContainer<PlayerSettingsGroup>
|
2017-10-03 00:33:58 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Spacing = new Vector2(0, 20),
|
2018-01-16 01:52:52 +08:00
|
|
|
|
Children = new PlayerSettingsGroup[]
|
2017-10-03 00:33:58 +08:00
|
|
|
|
{
|
|
|
|
|
//CollectionSettings = new CollectionSettings(),
|
|
|
|
|
//DiscussionSettings = new DiscussionSettings(),
|
2023-01-14 07:07:59 +08:00
|
|
|
|
PlaybackSettings = new PlaybackSettings { Expanded = { Value = false } },
|
2023-06-09 16:58:44 +08:00
|
|
|
|
VisualSettings = new VisualSettings { Expanded = { Value = false } },
|
|
|
|
|
new AudioSettings { Expanded = { Value = false } }
|
2017-10-03 00:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-10-03 00:33:58 +08:00
|
|
|
|
protected override void PopIn() => this.FadeIn(fade_duration);
|
|
|
|
|
protected override void PopOut() => this.FadeOut(fade_duration);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-05-05 09:31:11 +08:00
|
|
|
|
// We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible
|
2019-01-22 00:19:40 +08:00
|
|
|
|
public override bool PropagateNonPositionalInputSubTree => true;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
protected override bool OnKeyDown(KeyDownEvent e)
|
2017-10-03 00:33:58 +08:00
|
|
|
|
{
|
2018-10-02 11:02:47 +08:00
|
|
|
|
if (e.Repeat) return false;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-10-02 11:44:14 +08:00
|
|
|
|
if (e.ControlPressed)
|
2017-10-03 00:33:58 +08:00
|
|
|
|
{
|
2018-10-02 11:02:47 +08:00
|
|
|
|
if (e.Key == Key.H && ReplayLoaded)
|
2017-10-03 00:33:58 +08:00
|
|
|
|
{
|
|
|
|
|
ToggleVisibility();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
return base.OnKeyDown(e);
|
2017-10-03 00:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|