From 69832272400a122d28944f2a5fa38b8c000357ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 26 Jan 2026 20:50:20 +0900 Subject: [PATCH] Various metrics and visual tweaks --- .../UserInterfaceV2/FormControlBackground.cs | 11 +++-- .../Graphics/UserInterfaceV2/FormSliderBar.cs | 20 +++++--- .../Graphics/UserInterfaceV2/SwitchButton.cs | 15 +++--- .../Audio/AudioOffsetAdjustControl.cs | 48 +++++++++---------- .../Settings/Sections/InputSubsection.cs | 15 +++--- osu.Game/Overlays/Settings/SettingsItemV2.cs | 1 + osu.Game/Overlays/Settings/SettingsNote.cs | 4 +- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- 8 files changed, 66 insertions(+), 50 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/FormControlBackground.cs b/osu.Game/Graphics/UserInterfaceV2/FormControlBackground.cs index a4006f481e..7b9c5c4992 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormControlBackground.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormControlBackground.cs @@ -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); } } } diff --git a/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs b/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs index 9571dd4d86..95c5fc1b54 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs @@ -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) diff --git a/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs b/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs index 0ad912bcb9..3afb6d756b 100644 --- a/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs @@ -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); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Audio/AudioOffsetAdjustControl.cs b/osu.Game/Overlays/Settings/Sections/Audio/AudioOffsetAdjustControl.cs index f815cf82e6..df9646d211 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/AudioOffsetAdjustControl.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/AudioOffsetAdjustControl.cs @@ -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 @@ -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 - { - RelativeSizeAxes = Axes.X, - Width = 0.5f, - Height = 10, - Margin = new MarginPadding { Top = 2 }, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Padding = new MarginPadding - { - Horizontal = FormSliderBar.InnerSlider.NUB_WIDTH / 2 - }, - }, - }, - hintNote = new SettingsNote - { - RelativeSizeAxes = Axes.X, Padding = SettingsPanel.CONTENT_PADDING, - TextAnchor = Anchor.TopCentre, + Children = new Drawable[] + { + notchContainer = new Container + { + RelativeSizeAxes = Axes.X, + Width = 0.5f, + Height = 10, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Padding = new MarginPadding + { + Horizontal = FormSliderBar.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); } } } diff --git a/osu.Game/Overlays/Settings/Sections/InputSubsection.cs b/osu.Game/Overlays/Settings/Sections/InputSubsection.cs index 50fb688707..37c619f3cd 100644 --- a/osu.Game/Overlays/Settings/Sections/InputSubsection.cs +++ b/osu.Game/Overlays/Settings/Sections/InputSubsection.cs @@ -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(), }; diff --git a/osu.Game/Overlays/Settings/SettingsItemV2.cs b/osu.Game/Overlays/Settings/SettingsItemV2.cs index e6eddb4559..46287d900f 100644 --- a/osu.Game/Overlays/Settings/SettingsItemV2.cs +++ b/osu.Game/Overlays/Settings/SettingsItemV2.cs @@ -70,6 +70,7 @@ namespace osu.Game.Overlays.Settings { RelativeSizeAxes = Axes.X, Current = { BindTarget = Note }, + Depth = 1, }, }, }; diff --git a/osu.Game/Overlays/Settings/SettingsNote.cs b/osu.Game/Overlays/Settings/SettingsNote.cs index dec2694b4f..30e9be6424 100644 --- a/osu.Game/Overlays/Settings/SettingsNote.cs +++ b/osu.Game/Overlays/Settings/SettingsNote.cs @@ -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() diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index c3e995b81a..c22afa45a0 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Settings public virtual IEnumerable 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;