2017-05-17 15:36:57 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using OpenTK;
|
2017-05-19 11:41:33 +08:00
|
|
|
|
using OpenTK.Input;
|
2017-05-19 21:08:33 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-05-17 15:36:57 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-05-19 11:41:33 +08:00
|
|
|
|
using osu.Framework.Input;
|
2017-05-17 15:36:57 +08:00
|
|
|
|
|
2017-05-22 14:07:08 +08:00
|
|
|
|
namespace osu.Game.Screens.Play.ReplaySettings
|
2017-05-17 15:36:57 +08:00
|
|
|
|
{
|
2017-05-19 01:21:58 +08:00
|
|
|
|
public class ReplaySettingsOverlay : FillFlowContainer
|
2017-05-17 15:36:57 +08:00
|
|
|
|
{
|
2017-05-19 11:41:33 +08:00
|
|
|
|
private const int fade_duration = 100;
|
|
|
|
|
|
2017-05-17 20:54:12 +08:00
|
|
|
|
private bool isVisible;
|
2017-05-19 20:54:21 +08:00
|
|
|
|
|
|
|
|
|
private bool isAvaliable;
|
|
|
|
|
public bool IsAvaliable
|
2017-05-17 20:54:12 +08:00
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-05-19 20:54:21 +08:00
|
|
|
|
isAvaliable = value;
|
|
|
|
|
if (!isAvaliable) Hide();
|
|
|
|
|
}
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return isAvaliable;
|
2017-05-17 20:54:12 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-19 01:21:58 +08:00
|
|
|
|
public ReplaySettingsOverlay()
|
2017-05-17 15:36:57 +08:00
|
|
|
|
{
|
2017-05-19 11:41:33 +08:00
|
|
|
|
AlwaysPresent = true;
|
2017-05-17 15:36:57 +08:00
|
|
|
|
Direction = FillDirection.Vertical;
|
2017-05-19 21:08:33 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both;
|
2017-05-17 15:36:57 +08:00
|
|
|
|
Spacing = new Vector2(0, 20);
|
|
|
|
|
|
2017-05-18 16:39:22 +08:00
|
|
|
|
Add(new CollectionSettings());
|
|
|
|
|
Add(new DiscussionSettings());
|
|
|
|
|
Add(new PlaybackSettings());
|
2017-05-17 15:36:57 +08:00
|
|
|
|
}
|
2017-05-19 11:41:33 +08:00
|
|
|
|
|
|
|
|
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Repeat) return false;
|
|
|
|
|
|
|
|
|
|
if (state.Keyboard.ControlPressed)
|
|
|
|
|
{
|
|
|
|
|
switch (args.Key)
|
|
|
|
|
{
|
|
|
|
|
case Key.H:
|
2017-05-19 20:54:21 +08:00
|
|
|
|
toogleVisibility();
|
2017-05-19 11:41:33 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.OnKeyDown(state, args);
|
|
|
|
|
}
|
2017-05-19 20:54:21 +08:00
|
|
|
|
|
|
|
|
|
private void toogleVisibility()
|
|
|
|
|
{
|
|
|
|
|
if (isAvaliable)
|
|
|
|
|
{
|
|
|
|
|
if (isVisible)
|
|
|
|
|
FadeIn(fade_duration);
|
|
|
|
|
else
|
|
|
|
|
FadeOut(fade_duration);
|
|
|
|
|
|
|
|
|
|
isVisible = !isVisible;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-17 15:36:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|