Merge branch 'master' into fix-menu-state-display

This commit is contained in:
Bartłomiej Dach
2023-05-20 17:57:00 +02:00
committed by GitHub
467 changed files with 8012 additions and 2576 deletions

View File

@ -97,7 +97,9 @@ namespace osu.Game.Graphics.UserInterface
// Find the number of significant digits (we could have less than 5 after normalize())
int significantDigits = FormatUtils.FindPrecision(decimalPrecision);
return floatValue.ToString($"N{significantDigits}");
string negativeSign = Math.Round(floatValue, significantDigits) < 0 ? "-" : string.Empty;
return $"{negativeSign}{Math.Abs(floatValue).ToString($"N{significantDigits}")}";
}
/// <summary>

View File

@ -49,11 +49,10 @@ namespace osu.Game.Graphics.UserInterface
private const float transition_length = 500;
private Sample sampleChecked;
private Sample sampleUnchecked;
private readonly SpriteIcon icon;
public OsuTabControlCheckbox()
{
SpriteIcon icon;
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
@ -85,14 +84,6 @@ namespace osu.Game.Graphics.UserInterface
Anchor = Anchor.BottomLeft,
}
};
Current.ValueChanged += selected =>
{
icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
text.Font = text.Font.With(weight: selected.NewValue ? FontWeight.Bold : FontWeight.Medium);
updateFade();
};
}
[BackgroundDependencyLoader]
@ -105,6 +96,19 @@ namespace osu.Game.Graphics.UserInterface
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
}
protected override void LoadComplete()
{
base.LoadComplete();
Current.BindValueChanged(selected =>
{
icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
text.Font = text.Font.With(weight: selected.NewValue ? FontWeight.Bold : FontWeight.Medium);
updateFade();
}, true);
}
protected override bool OnHover(HoverEvent e)
{
updateFade();

View File

@ -249,13 +249,7 @@ namespace osu.Game.Graphics.UserInterface
private ColourInfo getSegmentColour(SegmentInfo segment)
{
var segmentColour = new ColourInfo
{
TopLeft = DrawColourInfo.Colour.Interpolate(new Vector2(segment.Start, 0f)),
TopRight = DrawColourInfo.Colour.Interpolate(new Vector2(segment.End, 0f)),
BottomLeft = DrawColourInfo.Colour.Interpolate(new Vector2(segment.Start, 1f)),
BottomRight = DrawColourInfo.Colour.Interpolate(new Vector2(segment.End, 1f))
};
var segmentColour = DrawColourInfo.Colour.Interpolate(new Quad(segment.Start, 0f, segment.End - segment.Start, 1f));
var tierColour = segment.Tier >= 0 ? tierColours[segment.Tier] : new Colour4(0, 0, 0, 0);
segmentColour.ApplyChild(tierColour);

View File

@ -12,6 +12,6 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public partial class TimeSlider : RoundedSliderBar<double>
{
public override LocalisableString TooltipText => $"{Current.Value:N0} ms";
public override LocalisableString TooltipText => $"{base.TooltipText} ms";
}
}