mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Merge pull request #29372 from ArijanJ/song-progress-optional-time
Add option to hide song progress time/text
This commit is contained in:
commit
16f6e26c2e
@ -19,6 +19,16 @@ namespace osu.Game.Localisation.HUD
|
||||
/// </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}";
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ namespace osu.Game.Screens.Play.HUD
|
||||
[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 @@ 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<HitObject> objects)
|
||||
|
@ -33,6 +33,9 @@ namespace osu.Game.Screens.Play.HUD
|
||||
[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,6 +85,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
Interactive.BindValueChanged(_ => updateBarVisibility(), true);
|
||||
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true);
|
||||
ShowTime.BindValueChanged(_ => updateTimeVisibility(), true);
|
||||
|
||||
base.LoadComplete();
|
||||
}
|
||||
@ -129,6 +133,13 @@ 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);
|
||||
|
Loading…
Reference in New Issue
Block a user