Merge pull request #10620 from peppy/tracked-hud-visibility-settings

Change shift-tab to cycle between available HUD visibility modes
This commit is contained in:
Dan Balasescu 2020-10-30 15:40:39 +09:00 committed by GitHub
commit fb6c88d39f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 12 deletions

View File

@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestExternalHideDoesntAffectConfig()
{
HUDVisibilityMode originalConfigValue = HUDVisibilityMode.HideDuringBreaks;
HUDVisibilityMode originalConfigValue = HUDVisibilityMode.HideDuringGameplay;
createNew();

View File

@ -12,9 +12,6 @@ namespace osu.Game.Configuration
[Description("Hide during gameplay")]
HideDuringGameplay,
[Description("Hide during breaks")]
HideDuringBreaks,
Always
}
}

View File

@ -170,6 +170,7 @@ namespace osu.Game.Configuration
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
{
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled")),
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, m => new SettingDescription(m, "HUD Visibility", m.GetDescription())),
new TrackedSetting<ScalingMode>(OsuSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())),
};
}

View File

@ -223,11 +223,6 @@ namespace osu.Game.Screens.Play
ShowHud.Value = false;
break;
case HUDVisibilityMode.HideDuringBreaks:
// always show during replay as we want the seek bar to be visible.
ShowHud.Value = replayLoaded.Value || !IsBreakTime.Value;
break;
case HUDVisibilityMode.HideDuringGameplay:
// always show during replay as we want the seek bar to be visible.
ShowHud.Value = replayLoaded.Value || IsBreakTime.Value;
@ -277,9 +272,21 @@ namespace osu.Game.Screens.Play
switch (e.Key)
{
case Key.Tab:
configVisibilityMode.Value = configVisibilityMode.Value != HUDVisibilityMode.Never
? HUDVisibilityMode.Never
: HUDVisibilityMode.HideDuringGameplay;
switch (configVisibilityMode.Value)
{
case HUDVisibilityMode.Never:
configVisibilityMode.Value = HUDVisibilityMode.HideDuringGameplay;
break;
case HUDVisibilityMode.HideDuringGameplay:
configVisibilityMode.Value = HUDVisibilityMode.Always;
break;
case HUDVisibilityMode.Always:
configVisibilityMode.Value = HUDVisibilityMode.Never;
break;
}
return true;
}
}