Merge pull request #20130 from Exanc/master

Display 0 stars instead of infinity for the minimum star slider
This commit is contained in:
Dean Herbert 2022-09-08 17:51:32 +09:00 committed by GitHub
commit d463bd2f3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 3 deletions

View File

@ -65,6 +65,13 @@ namespace osu.Game.Screens.Select
private class MinimumStarsSlider : StarsSlider
{
public MinimumStarsSlider()
: base("0")
{
}
public override LocalisableString TooltipText => Current.Value.ToString(@"0.## stars");
protected override void LoadComplete()
{
base.LoadComplete();
@ -82,6 +89,11 @@ namespace osu.Game.Screens.Select
private class MaximumStarsSlider : StarsSlider
{
public MaximumStarsSlider()
: base("∞")
{
}
protected override void LoadComplete()
{
base.LoadComplete();
@ -96,10 +108,17 @@ namespace osu.Game.Screens.Select
private class StarsSlider : OsuSliderBar<double>
{
private readonly string defaultString;
public override LocalisableString TooltipText => Current.IsDefault
? UserInterfaceStrings.NoLimit
: Current.Value.ToString(@"0.## stars");
protected StarsSlider(string defaultString)
{
this.defaultString = defaultString;
}
protected override bool OnHover(HoverEvent e)
{
base.OnHover(e);
@ -125,7 +144,7 @@ namespace osu.Game.Screens.Select
Current.BindValueChanged(current =>
{
currentDisplay.Text = current.NewValue != Current.Default ? current.NewValue.ToString("N1") : "∞";
currentDisplay.Text = current.NewValue != Current.Default ? current.NewValue.ToString("N1") : defaultString;
}, true);
}
}

View File

@ -127,10 +127,10 @@ namespace osu.Game.Screens.Select
config.SetValue(OsuSetting.DisplayStarsMaximum, 10.1);
});
string lowerStar = filter.UserStarDifficulty.Min == null ? "∞" : $"{filter.UserStarDifficulty.Min:N1}";
string lowerStar = $"{filter.UserStarDifficulty.Min ?? 0:N1}";
string upperStar = filter.UserStarDifficulty.Max == null ? "∞" : $"{filter.UserStarDifficulty.Max:N1}";
textFlow.AddText($" the {lowerStar}-{upperStar} star difficulty filter.");
textFlow.AddText($" the {lowerStar} - {upperStar} star difficulty filter.");
}
// TODO: Add realm queries to hint at which ruleset results are available in (and allow clicking to switch).