Skip to content

Commit

Permalink
Merge pull request #29372 from ArijanJ/song-progress-optional-time
Browse files Browse the repository at this point in the history
Add option to hide song progress time/text
  • Loading branch information
peppy authored Aug 12, 2024
2 parents acc7757 + fed5b9d commit 16f6e26
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
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

0 comments on commit 16f6e26

Please sign in to comment.