From 2dee8bef7e861b435bcaf8c737c8255b5aafe0a4 Mon Sep 17 00:00:00 2001 From: ArijanJ Date: Fri, 9 Aug 2024 22:50:37 +0200 Subject: [PATCH 1/3] Add option to hide song progress time/text --- osu.Game/Localisation/HUD/SongProgressStrings.cs | 10 ++++++++++ osu.Game/Screens/Play/HUD/ArgonSongProgress.cs | 4 ++++ osu.Game/Screens/Play/HUD/DefaultSongProgress.cs | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/osu.Game/Localisation/HUD/SongProgressStrings.cs b/osu.Game/Localisation/HUD/SongProgressStrings.cs index 4c621e8e8c..332f15cb17 100644 --- a/osu.Game/Localisation/HUD/SongProgressStrings.cs +++ b/osu.Game/Localisation/HUD/SongProgressStrings.cs @@ -19,6 +19,16 @@ namespace osu.Game.Localisation.HUD /// public static LocalisableString ShowGraphDescription => new TranslatableString(getKey(@"show_graph_description"), "Whether a graph displaying difficulty throughout the beatmap should be shown"); + /// + /// "Show time" + /// + public static LocalisableString ShowTime => new TranslatableString(getKey(@"show_time"), "Show time"); + + /// + /// "Whether the passed and remaining time should be shown" + /// + public static LocalisableString ShowTimeDescription => new TranslatableString(getKey(@"show_time_description"), "Whether the passed and remaining time should be shown"); + private static string getKey(string key) => $"{prefix}:{key}"; } } diff --git a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs index 7db3f9fd3c..ebebfebfb3 100644 --- a/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/ArgonSongProgress.cs @@ -26,6 +26,9 @@ namespace osu.Game.Screens.Play.HUD [SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowGraph), nameof(SongProgressStrings.ShowGraphDescription))] public Bindable ShowGraph { get; } = new BindableBool(true); + [SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowTime), nameof(SongProgressStrings.ShowTimeDescription))] + public Bindable ShowTime { get; } = new BindableBool(true); + [Resolved] private Player? player { get; set; } @@ -90,6 +93,7 @@ namespace osu.Game.Screens.Play.HUD Interactive.BindValueChanged(_ => bar.Interactive = Interactive.Value, true); ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true); + ShowTime.BindValueChanged(_ => info.FadeTo(ShowTime.Value ? 1 : 0, 200, Easing.In), true); } protected override void UpdateObjects(IEnumerable objects) diff --git a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs index f01c11855c..1586ac72a1 100644 --- a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs @@ -33,6 +33,9 @@ namespace osu.Game.Screens.Play.HUD [SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowGraph), nameof(SongProgressStrings.ShowGraphDescription))] public Bindable ShowGraph { get; } = new BindableBool(true); + [SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowTime), nameof(SongProgressStrings.ShowTimeDescription))] + public Bindable ShowTime { get; } = new BindableBool(true); + [Resolved] private Player? player { get; set; } @@ -82,9 +85,11 @@ namespace osu.Game.Screens.Play.HUD { Interactive.BindValueChanged(_ => updateBarVisibility(), true); ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true); + ShowTime.BindValueChanged(_ => updateTimeVisibility(), true); base.LoadComplete(); } + protected override void UpdateObjects(IEnumerable objects) { @@ -129,6 +134,14 @@ namespace osu.Game.Screens.Play.HUD updateInfoMargin(); } + private void updateTimeVisibility() + { + info.FadeTo(ShowTime.Value ? 1 : 0, transition_duration, Easing.In); + + updateInfoMargin(); + } + + private void updateInfoMargin() { float finalMargin = bottom_bar_height + (Interactive.Value ? handle_size.Y : 0) + (ShowGraph.Value ? graph_height : 0); From d01e76d9db3c4cffff803114edcbdf4c32dd6b5a Mon Sep 17 00:00:00 2001 From: ArijanJ Date: Fri, 9 Aug 2024 23:08:22 +0200 Subject: [PATCH 2/3] Fix double blank line --- osu.Game/Screens/Play/HUD/DefaultSongProgress.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs index 1586ac72a1..adb93c3ba3 100644 --- a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs @@ -89,7 +89,6 @@ namespace osu.Game.Screens.Play.HUD base.LoadComplete(); } - protected override void UpdateObjects(IEnumerable objects) { From fed5b9d7477f2118609b742c139c72aac800fd11 Mon Sep 17 00:00:00 2001 From: ArijanJ Date: Sat, 10 Aug 2024 09:45:30 +0200 Subject: [PATCH 3/3] Fix one more inspectcode warning --- osu.Game/Screens/Play/HUD/DefaultSongProgress.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs index adb93c3ba3..6b2bb2b718 100644 --- a/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs +++ b/osu.Game/Screens/Play/HUD/DefaultSongProgress.cs @@ -140,7 +140,6 @@ namespace osu.Game.Screens.Play.HUD updateInfoMargin(); } - private void updateInfoMargin() { float finalMargin = bottom_bar_height + (Interactive.Value ? handle_size.Y : 0) + (ShowGraph.Value ? graph_height : 0);