1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

Hud Visibility

This commit is contained in:
Andrey Zavadskiy 2017-03-31 16:43:31 +03:00
parent ba7f1233b3
commit d7c39a00b4
4 changed files with 58 additions and 5 deletions

View File

@ -36,6 +36,7 @@ namespace osu.Game.Configuration
Set(OsuConfig.MenuParallax, true);
Set(OsuConfig.KeyOverlay, false);
Set(OsuConfig.ShowInterface, true);
//todo: implement all settings below this line (remove the Disabled set when doing so).
Set(OsuConfig.MouseSpeed, 1.0).Disabled = true;
@ -89,7 +90,6 @@ namespace osu.Game.Configuration
Set(OsuConfig.LastVersionPermissionsFailed, string.Empty).Disabled = true;
Set(OsuConfig.LoadSubmittedThread, true).Disabled = true;
Set(OsuConfig.LobbyPlayMode, -1).Disabled = true;
Set(OsuConfig.ShowInterface, true).Disabled = true;
Set(OsuConfig.ShowInterfaceDuringRelax, false).Disabled = true;
Set(OsuConfig.LobbyShowExistingOnly, false).Disabled = true;
Set(OsuConfig.LobbyShowFriendsOnly, false).Disabled = true;

View File

@ -22,6 +22,9 @@ namespace osu.Game.Modes.UI
public readonly HealthDisplay HealthDisplay;
private Bindable<bool> showKeyCounter;
private Bindable<bool> showHud;
public bool IsVisible => showHud;
protected abstract KeyCounterCollection CreateKeyCounter();
protected abstract ComboCounter CreateComboCounter();
@ -47,11 +50,15 @@ namespace osu.Game.Modes.UI
private void load(OsuConfigManager config)
{
showKeyCounter = config.GetBindable<bool>(OsuConfig.KeyOverlay);
showKeyCounter.ValueChanged += visibilityChanged;
showKeyCounter.ValueChanged += keyCounterVisibilityChanged;
showKeyCounter.TriggerChange();
showHud = config.GetBindable<bool>(OsuConfig.ShowInterface);
showHud.ValueChanged += hudVisibilityChanged;
showHud.TriggerChange();
}
private void visibilityChanged(object sender, EventArgs e)
private void keyCounterVisibilityChanged(object sender, EventArgs e)
{
if (showKeyCounter)
KeyCounter.Show();
@ -59,6 +66,19 @@ namespace osu.Game.Modes.UI
KeyCounter.Hide();
}
private void hudVisibilityChanged(object sender, EventArgs e)
{
if (showHud)
Show();
else
Hide();
}
public void ChangeVisibility()
{
showHud.Value = !showHud.Value;
}
public void BindProcessor(ScoreProcessor processor)
{
//bind processor bindables to combocounter, score display etc.

View File

@ -39,6 +39,11 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.ScoreMeterScale)
},
new OsuCheckbox
{
LabelText = "Show score overlay",
Bindable = config.GetBindable<bool>(OsuConfig.ShowInterface)
},
new OsuCheckbox
{
LabelText = "Always show key overlay",
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)

View File

@ -22,6 +22,9 @@ using osu.Game.Screens.Ranking;
using System;
using System.Linq;
using osu.Game.Modes.Scoring;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using OpenTK.Input;
namespace osu.Game.Screens.Play
{
@ -59,8 +62,8 @@ namespace osu.Game.Screens.Play
private HudOverlay hudOverlay;
private PauseOverlay pauseOverlay;
[BackgroundDependencyLoader]
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config)
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, NotificationManager notificationManager)
{
var beatmap = Beatmap.Beatmap;
@ -158,6 +161,14 @@ namespace osu.Game.Screens.Play
hudOverlay,
pauseOverlay
};
if (!hudOverlay.IsVisible)
{
notificationManager?.Post(new SimpleNotification
{
Text = @"The score overlay is currently disabled. You can toogle this by pressing Shift + Tab."
});
}
}
private void initializeSkipButton()
@ -333,5 +344,22 @@ namespace osu.Game.Screens.Play
private Bindable<bool> mouseWheelDisabled;
protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused;
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Repeat) return false;
if (state.Keyboard.ShiftPressed)
{
switch (args.Key)
{
case Key.Tab:
hudOverlay.ChangeVisibility();
return true;
}
}
return base.OnKeyDown(state, args);
}
}
}