Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to hide song progress time/text #29372

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions osu.Game/Localisation/HUD/SongProgressStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public static class SongProgressStrings
/// </summary>
public static LocalisableString ShowGraphDescription => new TranslatableString(getKey(@"show_graph_description"), "Whether a graph displaying difficulty throughout the beatmap should be shown");

/// <summary>
/// "Show time"
/// </summary>
public static LocalisableString ShowTime => new TranslatableString(getKey(@"show_time"), "Show time");

/// <summary>
/// "Whether the passed and remaining time should be shown"
/// </summary>
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}";
}
}
4 changes: 4 additions & 0 deletions osu.Game/Screens/Play/HUD/ArgonSongProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public partial class ArgonSongProgress : SongProgress
[SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowGraph), nameof(SongProgressStrings.ShowGraphDescription))]
public Bindable<bool> ShowGraph { get; } = new BindableBool(true);

[SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowTime), nameof(SongProgressStrings.ShowTimeDescription))]
public Bindable<bool> ShowTime { get; } = new BindableBool(true);

[Resolved]
private Player? player { get; set; }

Expand Down Expand Up @@ -90,6 +93,7 @@ protected override void LoadComplete()

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<HitObject> objects)
Expand Down
11 changes: 11 additions & 0 deletions osu.Game/Screens/Play/HUD/DefaultSongProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public partial class DefaultSongProgress : SongProgress
[SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowGraph), nameof(SongProgressStrings.ShowGraphDescription))]
public Bindable<bool> ShowGraph { get; } = new BindableBool(true);

[SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowTime), nameof(SongProgressStrings.ShowTimeDescription))]
public Bindable<bool> ShowTime { get; } = new BindableBool(true);

[Resolved]
private Player? player { get; set; }

Expand Down Expand Up @@ -82,6 +85,7 @@ protected override void LoadComplete()
{
Interactive.BindValueChanged(_ => updateBarVisibility(), true);
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true);
ShowTime.BindValueChanged(_ => updateTimeVisibility(), true);

base.LoadComplete();
}
Expand Down Expand Up @@ -129,6 +133,13 @@ private void updateGraphVisibility()
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);
Expand Down
Loading