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 "Use relative size" setting to argon & default song progress #30334

Merged
merged 3 commits into from
Oct 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public static class SkinnableComponentStrings
/// </summary>
public static LocalisableString TextColourDescription => new TranslatableString(getKey(@"text_colour_description"), @"The colour of the text.");

/// <summary>
/// "Use relative size"
/// </summary>
public static LocalisableString UseRelativeSize => new TranslatableString(getKey(@"use_relative_size"), @"Use relative size");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}
3 changes: 2 additions & 1 deletion osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using osu.Framework.Threading;
using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Localisation.SkinComponents;
using osu.Game.Rulesets.Judgements;
using osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts;
using osu.Game.Skinning;
Expand All @@ -33,7 +34,7 @@ public partial class ArgonHealthDisplay : HealthDisplay, ISerialisableDrawable
Precision = 1
};

[SettingSource("Use relative size")]
[SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.UseRelativeSize))]
public BindableBool UseRelativeSize { get; } = new BindableBool(true);

private ArgonHealthDisplayBar mainBar = null!;
Expand Down
8 changes: 8 additions & 0 deletions osu.Game/Screens/Play/HUD/ArgonSongProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public partial class ArgonSongProgress : SongProgress
[SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowTime), nameof(SongProgressStrings.ShowTimeDescription))]
public Bindable<bool> ShowTime { get; } = new BindableBool(true);

[SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.UseRelativeSize))]
public BindableBool UseRelativeSize { get; } = new BindableBool(true);

[SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.Colour), nameof(SkinnableComponentStrings.ColourDescription))]
public BindableColour4 AccentColour { get; } = new BindableColour4(Colour4.White);

Expand Down Expand Up @@ -99,6 +102,11 @@ protected override void LoadComplete()
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true);
ShowTime.BindValueChanged(_ => info.FadeTo(ShowTime.Value ? 1 : 0, 200, Easing.In), true);
AccentColour.BindValueChanged(_ => Colour = AccentColour.Value, true);

// see comment in ArgonHealthDisplay.cs regarding RelativeSizeAxes
float previousWidth = Width;
UseRelativeSize.BindValueChanged(v => RelativeSizeAxes = v.NewValue ? Axes.X : Axes.None, true);
Width = previousWidth;
}

protected override void UpdateObjects(IEnumerable<HitObject> objects)
Expand Down
8 changes: 8 additions & 0 deletions osu.Game/Screens/Play/HUD/DefaultSongProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public partial class DefaultSongProgress : SongProgress
[SettingSource(typeof(SongProgressStrings), nameof(SongProgressStrings.ShowTime), nameof(SongProgressStrings.ShowTimeDescription))]
public Bindable<bool> ShowTime { get; } = new BindableBool(true);

[SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.UseRelativeSize))]
public BindableBool UseRelativeSize { get; } = new BindableBool(true);

[SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.Colour), nameof(SkinnableComponentStrings.ColourDescription))]
public BindableColour4 AccentColour { get; } = new BindableColour4(Colour4.White);

Expand Down Expand Up @@ -83,6 +86,11 @@ public DefaultSongProgress()
private void load(OsuColour colours)
{
graph.FillColour = bar.FillColour = colours.BlueLighter;

// see comment in ArgonHealthDisplay.cs regarding RelativeSizeAxes
float previousWidth = Width;
UseRelativeSize.BindValueChanged(v => RelativeSizeAxes = v.NewValue ? Axes.X : Axes.None, true);
Width = previousWidth;
}

protected override void LoadComplete()
Expand Down
Loading