mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 13:32:54 +08:00
Hud Visibility
This commit is contained in:
parent
ba7f1233b3
commit
d7c39a00b4
@ -36,6 +36,7 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.MenuParallax, true);
|
Set(OsuConfig.MenuParallax, true);
|
||||||
|
|
||||||
Set(OsuConfig.KeyOverlay, false);
|
Set(OsuConfig.KeyOverlay, false);
|
||||||
|
Set(OsuConfig.ShowInterface, true);
|
||||||
//todo: implement all settings below this line (remove the Disabled set when doing so).
|
//todo: implement all settings below this line (remove the Disabled set when doing so).
|
||||||
|
|
||||||
Set(OsuConfig.MouseSpeed, 1.0).Disabled = true;
|
Set(OsuConfig.MouseSpeed, 1.0).Disabled = true;
|
||||||
@ -89,7 +90,6 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.LastVersionPermissionsFailed, string.Empty).Disabled = true;
|
Set(OsuConfig.LastVersionPermissionsFailed, string.Empty).Disabled = true;
|
||||||
Set(OsuConfig.LoadSubmittedThread, true).Disabled = true;
|
Set(OsuConfig.LoadSubmittedThread, true).Disabled = true;
|
||||||
Set(OsuConfig.LobbyPlayMode, -1).Disabled = true;
|
Set(OsuConfig.LobbyPlayMode, -1).Disabled = true;
|
||||||
Set(OsuConfig.ShowInterface, true).Disabled = true;
|
|
||||||
Set(OsuConfig.ShowInterfaceDuringRelax, false).Disabled = true;
|
Set(OsuConfig.ShowInterfaceDuringRelax, false).Disabled = true;
|
||||||
Set(OsuConfig.LobbyShowExistingOnly, false).Disabled = true;
|
Set(OsuConfig.LobbyShowExistingOnly, false).Disabled = true;
|
||||||
Set(OsuConfig.LobbyShowFriendsOnly, false).Disabled = true;
|
Set(OsuConfig.LobbyShowFriendsOnly, false).Disabled = true;
|
||||||
|
@ -22,6 +22,9 @@ namespace osu.Game.Modes.UI
|
|||||||
public readonly HealthDisplay HealthDisplay;
|
public readonly HealthDisplay HealthDisplay;
|
||||||
|
|
||||||
private Bindable<bool> showKeyCounter;
|
private Bindable<bool> showKeyCounter;
|
||||||
|
private Bindable<bool> showHud;
|
||||||
|
|
||||||
|
public bool IsVisible => showHud;
|
||||||
|
|
||||||
protected abstract KeyCounterCollection CreateKeyCounter();
|
protected abstract KeyCounterCollection CreateKeyCounter();
|
||||||
protected abstract ComboCounter CreateComboCounter();
|
protected abstract ComboCounter CreateComboCounter();
|
||||||
@ -47,11 +50,15 @@ namespace osu.Game.Modes.UI
|
|||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
showKeyCounter = config.GetBindable<bool>(OsuConfig.KeyOverlay);
|
showKeyCounter = config.GetBindable<bool>(OsuConfig.KeyOverlay);
|
||||||
showKeyCounter.ValueChanged += visibilityChanged;
|
showKeyCounter.ValueChanged += keyCounterVisibilityChanged;
|
||||||
showKeyCounter.TriggerChange();
|
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)
|
if (showKeyCounter)
|
||||||
KeyCounter.Show();
|
KeyCounter.Show();
|
||||||
@ -59,6 +66,19 @@ namespace osu.Game.Modes.UI
|
|||||||
KeyCounter.Hide();
|
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)
|
public void BindProcessor(ScoreProcessor processor)
|
||||||
{
|
{
|
||||||
//bind processor bindables to combocounter, score display etc.
|
//bind processor bindables to combocounter, score display etc.
|
||||||
|
@ -39,6 +39,11 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
|
|||||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.ScoreMeterScale)
|
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.ScoreMeterScale)
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OsuCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Show score overlay",
|
||||||
|
Bindable = config.GetBindable<bool>(OsuConfig.ShowInterface)
|
||||||
|
},
|
||||||
|
new OsuCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Always show key overlay",
|
LabelText = "Always show key overlay",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
|
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
|
||||||
|
@ -22,6 +22,9 @@ using osu.Game.Screens.Ranking;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Modes.Scoring;
|
using osu.Game.Modes.Scoring;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Notifications;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -59,8 +62,8 @@ namespace osu.Game.Screens.Play
|
|||||||
private HudOverlay hudOverlay;
|
private HudOverlay hudOverlay;
|
||||||
private PauseOverlay pauseOverlay;
|
private PauseOverlay pauseOverlay;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, NotificationManager notificationManager)
|
||||||
{
|
{
|
||||||
var beatmap = Beatmap.Beatmap;
|
var beatmap = Beatmap.Beatmap;
|
||||||
|
|
||||||
@ -158,6 +161,14 @@ namespace osu.Game.Screens.Play
|
|||||||
hudOverlay,
|
hudOverlay,
|
||||||
pauseOverlay
|
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()
|
private void initializeSkipButton()
|
||||||
@ -333,5 +344,22 @@ namespace osu.Game.Screens.Play
|
|||||||
private Bindable<bool> mouseWheelDisabled;
|
private Bindable<bool> mouseWheelDisabled;
|
||||||
|
|
||||||
protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user