mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Remember state of replay settings visibility
This commit is contained in:
parent
fbab5acac1
commit
95a9b532df
@ -129,6 +129,7 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault(OsuSetting.ShowHealthDisplayWhenCantFail, true);
|
SetDefault(OsuSetting.ShowHealthDisplayWhenCantFail, true);
|
||||||
SetDefault(OsuSetting.FadePlayfieldWhenHealthLow, true);
|
SetDefault(OsuSetting.FadePlayfieldWhenHealthLow, true);
|
||||||
SetDefault(OsuSetting.KeyOverlay, false);
|
SetDefault(OsuSetting.KeyOverlay, false);
|
||||||
|
SetDefault(OsuSetting.ReplaySettingsOverlay, true);
|
||||||
SetDefault(OsuSetting.GameplayLeaderboard, true);
|
SetDefault(OsuSetting.GameplayLeaderboard, true);
|
||||||
SetDefault(OsuSetting.AlwaysPlayFirstComboBreak, true);
|
SetDefault(OsuSetting.AlwaysPlayFirstComboBreak, true);
|
||||||
|
|
||||||
@ -382,6 +383,7 @@ namespace osu.Game.Configuration
|
|||||||
SafeAreaConsiderations,
|
SafeAreaConsiderations,
|
||||||
ComboColourNormalisationAmount,
|
ComboColourNormalisationAmount,
|
||||||
ProfileCoverExpanded,
|
ProfileCoverExpanded,
|
||||||
EditorLimitedDistanceSnap
|
EditorLimitedDistanceSnap,
|
||||||
|
ReplaySettingsOverlay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,15 @@ namespace osu.Game.Localisation
|
|||||||
public static LocalisableString HUDVisibilityMode => new TranslatableString(getKey(@"hud_visibility_mode"), @"HUD overlay visibility mode");
|
public static LocalisableString HUDVisibilityMode => new TranslatableString(getKey(@"hud_visibility_mode"), @"HUD overlay visibility mode");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Show health display even when you can't fail"
|
/// "Show health display even when you can't fail"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString ShowHealthDisplayWhenCantFail => new TranslatableString(getKey(@"show_health_display_when_cant_fail"), @"Show health display even when you can't fail");
|
public static LocalisableString ShowHealthDisplayWhenCantFail => new TranslatableString(getKey(@"show_health_display_when_cant_fail"), @"Show health display even when you can't fail");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Show replay settings overlay"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ShowReplaySettingsOverlay => new TranslatableString(getKey(@"show_replay_settings_overlay"), @"Show replay settings overlay");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Fade playfield to red when health is low"
|
/// "Fade playfield to red when health is low"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -134,6 +139,6 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString ClassicScoreDisplay => new TranslatableString(getKey(@"classic_score_display"), @"Classic");
|
public static LocalisableString ClassicScoreDisplay => new TranslatableString(getKey(@"classic_score_display"), @"Classic");
|
||||||
|
|
||||||
private static string getKey(string key) => $"{prefix}:{key}";
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,9 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
|||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
ClassicDefault = false,
|
LabelText = GameplaySettingsStrings.ShowReplaySettingsOverlay,
|
||||||
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
|
Current = config.GetBindable<bool>(OsuSetting.ReplaySettingsOverlay),
|
||||||
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
Keywords = new[] { "hide" },
|
||||||
Keywords = new[] { "hp", "bar" }
|
|
||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
@ -41,6 +40,13 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
|||||||
LabelText = GameplaySettingsStrings.AlwaysShowGameplayLeaderboard,
|
LabelText = GameplaySettingsStrings.AlwaysShowGameplayLeaderboard,
|
||||||
Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard),
|
Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard),
|
||||||
},
|
},
|
||||||
|
new SettingsCheckbox
|
||||||
|
{
|
||||||
|
ClassicDefault = false,
|
||||||
|
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
|
||||||
|
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||||
|
Keywords = new[] { "hp", "bar" }
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,8 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
using osuTK.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
@ -14,16 +12,12 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
private const int fade_duration = 200;
|
private const int fade_duration = 200;
|
||||||
|
|
||||||
public bool ReplayLoaded;
|
|
||||||
|
|
||||||
public readonly PlaybackSettings PlaybackSettings;
|
public readonly PlaybackSettings PlaybackSettings;
|
||||||
|
|
||||||
public readonly VisualSettings VisualSettings;
|
public readonly VisualSettings VisualSettings;
|
||||||
|
|
||||||
public PlayerSettingsOverlay()
|
public PlayerSettingsOverlay()
|
||||||
{
|
{
|
||||||
AlwaysPresent = true;
|
|
||||||
|
|
||||||
Anchor = Anchor.TopRight;
|
Anchor = Anchor.TopRight;
|
||||||
Origin = Anchor.TopRight;
|
Origin = Anchor.TopRight;
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -46,24 +40,5 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
protected override void PopIn() => this.FadeIn(fade_duration);
|
protected override void PopIn() => this.FadeIn(fade_duration);
|
||||||
protected override void PopOut() => this.FadeOut(fade_duration);
|
protected override void PopOut() => this.FadeOut(fade_duration);
|
||||||
|
|
||||||
// We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible
|
|
||||||
public override bool PropagateNonPositionalInputSubTree => true;
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
|
||||||
{
|
|
||||||
if (e.Repeat) return false;
|
|
||||||
|
|
||||||
if (e.ControlPressed)
|
|
||||||
{
|
|
||||||
if (e.Key == Key.H && ReplayLoaded)
|
|
||||||
{
|
|
||||||
ToggleVisibility();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnKeyDown(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ using osu.Game.Screens.Play.HUD.ClicksPerSecond;
|
|||||||
using osu.Game.Screens.Play.HUD.JudgementCounter;
|
using osu.Game.Screens.Play.HUD.JudgementCounter;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using MarginPadding = osu.Framework.Graphics.MarginPadding;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -78,6 +79,7 @@ namespace osu.Game.Screens.Play
|
|||||||
public Bindable<bool> ShowHud { get; } = new BindableBool();
|
public Bindable<bool> ShowHud { get; } = new BindableBool();
|
||||||
|
|
||||||
private Bindable<HUDVisibilityMode> configVisibilityMode;
|
private Bindable<HUDVisibilityMode> configVisibilityMode;
|
||||||
|
private Bindable<bool> configSettingsOverlay;
|
||||||
|
|
||||||
private readonly BindableBool replayLoaded = new BindableBool();
|
private readonly BindableBool replayLoaded = new BindableBool();
|
||||||
|
|
||||||
@ -178,6 +180,7 @@ namespace osu.Game.Screens.Play
|
|||||||
ModDisplay.Current.Value = mods;
|
ModDisplay.Current.Value = mods;
|
||||||
|
|
||||||
configVisibilityMode = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode);
|
configVisibilityMode = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode);
|
||||||
|
configSettingsOverlay = config.GetBindable<bool>(OsuSetting.ReplaySettingsOverlay);
|
||||||
|
|
||||||
if (configVisibilityMode.Value == HUDVisibilityMode.Never && !hasShownNotificationOnce)
|
if (configVisibilityMode.Value == HUDVisibilityMode.Never && !hasShownNotificationOnce)
|
||||||
{
|
{
|
||||||
@ -204,9 +207,24 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
holdingForHUD.BindValueChanged(_ => updateVisibility());
|
holdingForHUD.BindValueChanged(_ => updateVisibility());
|
||||||
IsPlaying.BindValueChanged(_ => updateVisibility());
|
IsPlaying.BindValueChanged(_ => updateVisibility());
|
||||||
configVisibilityMode.BindValueChanged(_ => updateVisibility(), true);
|
configVisibilityMode.BindValueChanged(_ => updateVisibility());
|
||||||
|
configSettingsOverlay.BindValueChanged(_ => updateVisibility());
|
||||||
|
|
||||||
replayLoaded.BindValueChanged(replayLoadedValueChanged, true);
|
replayLoaded.BindValueChanged(e =>
|
||||||
|
{
|
||||||
|
if (e.NewValue)
|
||||||
|
{
|
||||||
|
ModDisplay.FadeIn(200);
|
||||||
|
InputCountController.Margin = new MarginPadding(10) { Bottom = 30 };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ModDisplay.Delay(2000).FadeOut(200);
|
||||||
|
InputCountController.Margin = new MarginPadding(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateVisibility();
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -280,6 +298,11 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configSettingsOverlay.Value && replayLoaded.Value)
|
||||||
|
PlayerSettingsOverlay.Show();
|
||||||
|
else
|
||||||
|
PlayerSettingsOverlay.Hide();
|
||||||
|
|
||||||
switch (configVisibilityMode.Value)
|
switch (configVisibilityMode.Value)
|
||||||
{
|
{
|
||||||
case HUDVisibilityMode.Never:
|
case HUDVisibilityMode.Never:
|
||||||
@ -297,26 +320,6 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void replayLoadedValueChanged(ValueChangedEvent<bool> e)
|
|
||||||
{
|
|
||||||
PlayerSettingsOverlay.ReplayLoaded = e.NewValue;
|
|
||||||
|
|
||||||
if (e.NewValue)
|
|
||||||
{
|
|
||||||
PlayerSettingsOverlay.Show();
|
|
||||||
ModDisplay.FadeIn(200);
|
|
||||||
InputCountController.Margin = new MarginPadding(10) { Bottom = 30 };
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlayerSettingsOverlay.Hide();
|
|
||||||
ModDisplay.Delay(2000).FadeOut(200);
|
|
||||||
InputCountController.Margin = new MarginPadding(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void BindDrawableRuleset(DrawableRuleset drawableRuleset)
|
protected virtual void BindDrawableRuleset(DrawableRuleset drawableRuleset)
|
||||||
{
|
{
|
||||||
if (drawableRuleset is ICanAttachHUDPieces attachTarget)
|
if (drawableRuleset is ICanAttachHUDPieces attachTarget)
|
||||||
|
Loading…
Reference in New Issue
Block a user