1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-26 03:49:56 +08:00

Various metrics and visual tweaks

This commit is contained in:
Dean Herbert
2026-01-26 20:50:20 +09:00
Unverified
parent 585ce682ef
commit 6983227240
8 changed files with 66 additions and 50 deletions
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
@@ -59,6 +60,8 @@ namespace osu.Game.Graphics.UserInterfaceV2
CornerRadius = 5;
CornerExponent = 2.5f;
BorderThickness = 2.5f;
InternalChildren = new Drawable[]
{
box = new Box
@@ -84,8 +87,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
private void updateStyling()
{
ColourInfo colour = colourProvider.Background5;
ColourInfo colour = colourProvider.Background4.Darken(0.1f);
ColourInfo borderColour = colourProvider.Light4;
bool border = false;
if (styleDisabled)
@@ -105,10 +109,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
border = true;
}
BorderThickness = border ? 2 : 0;
BorderColour = borderColour;
this.TransformTo(nameof(BorderColour), border ? borderColour : colour, 250, Easing.OutQuint);
box.FadeColour(colour, 500, Easing.OutQuint);
box.FadeColour(colour, 250, Easing.OutQuint);
}
}
}
@@ -22,6 +22,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osuTK.Graphics;
using Vector2 = osuTK.Vector2;
namespace osu.Game.Graphics.UserInterfaceV2
@@ -325,8 +326,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
currentNumberInstantaneous.TriggerChange();
current.Value = currentNumberInstantaneous.Value;
flashLayer.Colour = ColourInfo.GradientVertical(colourProvider.Dark2.Opacity(0), colourProvider.Dark2);
flashLayer.FadeOutFromOne(800, Easing.OutQuint);
background.Flash();
}
private void tryUpdateSliderFromTextBox()
@@ -502,7 +502,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
protected override void LoadComplete()
{
base.LoadComplete();
Current.BindDisabledChanged(_ => updateState(), true);
FinishTransforms(true);
}
protected override void UpdateAfterChildren()
@@ -558,16 +560,22 @@ namespace osu.Game.Graphics.UserInterfaceV2
sounds.Enabled.Value = !Current.Disabled;
rightBox.Colour = colourProvider.Background6;
Color4 leftColour;
Color4 nubColour;
if (Current.Disabled)
{
leftBox.Colour = colourProvider.Dark3;
nub.Colour = colourProvider.Dark1;
leftColour = colourProvider.Dark3;
nubColour = colourProvider.Dark1;
}
else
{
leftBox.Colour = HasFocus || IsHovered || IsDragged ? colourProvider.Highlight1.Opacity(0.5f) : colourProvider.Highlight1.Opacity(0.3f);
nub.Colour = HasFocus || IsHovered || IsDragged ? colourProvider.Highlight1 : colourProvider.Light4;
leftColour = HasFocus || IsHovered || IsDragged ? colourProvider.Highlight1.Opacity(0.5f) : colourProvider.Highlight1.Opacity(0.3f);
nubColour = HasFocus || IsHovered || IsDragged ? colourProvider.Highlight1 : colourProvider.Light4;
}
leftBox.FadeColour(leftColour, 250, Easing.OutQuint);
nub.FadeColour(nubColour, 250, Easing.OutQuint);
}
protected override void UpdateValue(float value)
@@ -19,20 +19,22 @@ namespace osu.Game.Graphics.UserInterfaceV2
{
public partial class SwitchButton : Checkbox
{
public const float WIDTH = 60;
public const float WIDTH = 56;
private readonly Box fill;
private readonly CircularContainer content;
private readonly Container content;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public bool ExpandOnCurrent { get; init; } = true;
private Sample? sampleChecked;
private Sample? sampleUnchecked;
public SwitchButton()
{
Size = new Vector2(WIDTH, 20);
Size = new Vector2(WIDTH, 16);
InternalChild = content = new CircularContainer
{
@@ -40,8 +42,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
BorderColour = Color4.White,
BorderThickness = 4,
BorderThickness = 3.2f,
Masking = true,
CornerExponent = 2.5f,
Children = new Drawable[]
{
fill = new Box
@@ -98,7 +101,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
private void updateState()
{
Color4 fillColour = colourProvider.Background6;
Color4 fillColour = colourProvider.Background5.Opacity(0);
Color4 borderColour = colourProvider.Light4;
if (IsHovered)
@@ -118,7 +121,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
fill.FadeColour(fillColour, 250, Easing.OutQuint);
content.TransformTo(nameof(BorderColour), (ColourInfo)borderColour, 250, Easing.OutQuint);
content.ResizeWidthTo(Current.Value ? 1 : 0.75f, 250, Easing.OutQuint);
content.ResizeWidthTo(ExpandOnCurrent && Current.Value ? 1 : 0.75f, 250, Easing.OutQuint);
}
}
}
@@ -16,6 +16,7 @@ using osu.Game.Extensions;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation;
using osu.Game.Screens.Play.PlayerSettings;
using osuTK;
namespace osu.Game.Overlays.Settings.Sections.Audio
{
@@ -52,6 +53,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(SettingsSection.ITEM_SPACING_V2),
Children = new Drawable[]
{
new SettingsItemV2(new FormSliderBar<double>
@@ -67,30 +69,23 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding
{
Left = SettingsPanel.CONTENT_PADDING.Left + 9,
Right = SettingsPanel.CONTENT_PADDING.Right + 5
},
Child = notchContainer = new Container<Circle>
{
RelativeSizeAxes = Axes.X,
Width = 0.5f,
Height = 10,
Margin = new MarginPadding { Top = 2 },
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Padding = new MarginPadding
{
Horizontal = FormSliderBar<double>.InnerSlider.NUB_WIDTH / 2
},
},
},
hintNote = new SettingsNote
{
RelativeSizeAxes = Axes.X,
Padding = SettingsPanel.CONTENT_PADDING,
TextAnchor = Anchor.TopCentre,
Children = new Drawable[]
{
notchContainer = new Container<Circle>
{
RelativeSizeAxes = Axes.X,
Width = 0.5f,
Height = 10,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Padding = new MarginPadding
{
Horizontal = FormSliderBar<double>.InnerSlider.NUB_WIDTH / 2
},
},
hintNote = new SettingsNote { RelativeSizeAxes = Axes.X },
}
},
applySuggestion = new RoundedButton
{
@@ -166,18 +161,23 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
applySuggestion.Enabled.Value = false;
notchContainer.Hide();
hintNote.Current.Value = new SettingsNote.Data(AudioSettingsStrings.SuggestedOffsetNote, SettingsNote.Type.Informational);
hintNote.MoveToY(0, 200, Easing.OutQuint);
}
else if (Math.Abs(SuggestedOffset.Value.Value - current.Value) < 1)
{
applySuggestion.Enabled.Value = false;
notchContainer.Show();
hintNote.Current.Value = new SettingsNote.Data(AudioSettingsStrings.SuggestedOffsetCorrect(averageHitErrorHistory.Count), SettingsNote.Type.Informational);
hintNote.MoveToY(10, 200, Easing.OutQuint);
}
else
{
applySuggestion.Enabled.Value = true;
notchContainer.Show();
hintNote.Current.Value = new SettingsNote.Data(AudioSettingsStrings.SuggestedOffsetValueReceived(averageHitErrorHistory.Count, SuggestedOffset.Value.Value.ToStandardFormattedString(0)), SettingsNote.Type.Informational);
hintNote.Current.Value =
new SettingsNote.Data(AudioSettingsStrings.SuggestedOffsetValueReceived(averageHitErrorHistory.Count, SuggestedOffset.Value.Value.ToStandardFormattedString(0)),
SettingsNote.Type.Informational);
hintNote.MoveToY(10, 200, Easing.OutQuint);
}
}
}
@@ -111,18 +111,19 @@ namespace osu.Game.Overlays.Settings.Sections
{
switchButton = new SwitchButton
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Scale = new Vector2(0.6f),
Position = new Vector2(12, 8),
Rotation = 90,
ExpandOnCurrent = false,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 15,
Height = 22,
},
headerText = new OsuSpriteText
{
Text = header,
Font = OsuFont.GetFont(size: 20),
Font = OsuFont.Style.Heading2,
Margin = new MarginPadding { Vertical = 12 },
X = 20,
X = 18,
Y = -1,
},
new HoverSounds(),
};
@@ -70,6 +70,7 @@ namespace osu.Game.Overlays.Settings
{
RelativeSizeAxes = Axes.X,
Current = { BindTarget = Note },
Depth = 1,
},
},
};
+2 -2
View File
@@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Settings
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Top = 5, Bottom = 5 },
Padding = new MarginPadding { Top = SettingsSection.ITEM_SPACING_V2 },
Child = new Container
{
RelativeSizeAxes = Axes.X,
@@ -74,8 +74,8 @@ namespace osu.Game.Overlays.Settings
protected override void LoadComplete()
{
base.LoadComplete();
Current.BindValueChanged(_ => updateDisplay(), true);
FinishTransforms(true);
}
private void updateDisplay()
@@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Settings
public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Header };
public const int ITEM_SPACING = 14;
public const int ITEM_SPACING_V2 = 7;
public const int ITEM_SPACING_V2 = 4;
private const int header_size = 24;
private const int border_size = 4;