Add option to hide song progress time/text

This commit is contained in:
ArijanJ 2024-08-09 22:50:37 +02:00
parent dbd2e2e91f
commit 2dee8bef7e
No known key found for this signature in database
GPG Key ID: FD97BF15489FDE05
3 changed files with 27 additions and 0 deletions

View File

@ -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}";
}
}

View File

@ -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; }
@ -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)

View File

@ -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; }
@ -82,10 +85,12 @@ protected override void LoadComplete()
{
Interactive.BindValueChanged(_ => updateBarVisibility(), true);
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true);
ShowTime.BindValueChanged(_ => updateTimeVisibility(), true);
base.LoadComplete();
}
protected override void UpdateObjects(IEnumerable<HitObject> objects)
{
graph.Objects = objects;
@ -129,6 +134,14 @@ 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);