From 6daa36477942d6179683ec59387ae898f0e0936b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9miah=20D=C3=89COMBE?= Date: Mon, 23 Jan 2023 13:53:31 +0100 Subject: [PATCH 01/24] adding setting to adjust blur of the background of the song select screen --- osu.Game/Configuration/OsuConfigManager.cs | 3 ++ osu.Game/Localisation/UserInterfaceStrings.cs | 6 ++++ .../UserInterface/SongSelectSettings.cs | 5 +++ osu.Game/Screens/Select/SongSelect.cs | 33 +++++++++++++++++-- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 6cbb677a64..2b7c2102d4 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -60,6 +60,8 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.ToolbarClockDisplayMode, ToolbarClockDisplayMode.Full); + SetDefault(OsuSetting.BeatmapSelectionBlurLevel, 1f, 0, 1f, 0.01f); + // Online settings SetDefault(OsuSetting.Username, string.Empty); SetDefault(OsuSetting.Token, string.Empty); @@ -339,6 +341,7 @@ namespace osu.Game.Configuration ChatDisplayHeight, BeatmapListingCardSize, ToolbarClockDisplayMode, + BeatmapSelectionBlurLevel, Version, ShowFirstRunSetup, ShowConvertedBeatmaps, diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index ea664d7b50..0bf7dae403 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -109,6 +109,12 @@ namespace osu.Game.Localisation /// public static LocalisableString ModSelectHotkeyStyle => new TranslatableString(getKey(@"mod_select_hotkey_style"), @"Mod select hotkey style"); + /// + /// "Beatmap selection blur level" + /// + public static LocalisableString BeatmapSelectionBlurLevel => new TranslatableString(getKey(@"beatmap_selection_blur_level"), @"Beatmap selection blur level"); + + /// /// "no limit" /// diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 8b5e0b75b7..828119981f 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -42,6 +42,11 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface LabelText = UserInterfaceStrings.ModSelectHotkeyStyle, Current = config.GetBindable(OsuSetting.ModSelectHotkeyStyle), ClassicDefault = ModSelectHotkeyStyle.Classic + }, + new SettingsSlider + { + LabelText = UserInterfaceStrings.BeatmapSelectionBlurLevel, + Current = config.GetBindable(OsuSetting.BeatmapSelectionBlurLevel) } }; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 4b3222c14a..bd1498f0dd 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -35,6 +35,7 @@ using osu.Game.Collections; using osu.Game.Graphics.UserInterface; using System.Diagnostics; using osu.Framework.Extensions.ObjectExtensions; +using osu.Game.Configuration; using osu.Game.Screens.Play; using osu.Game.Skinning; @@ -124,9 +125,26 @@ namespace osu.Game.Screens.Select [Resolved] internal IOverlayManager? OverlayManager { get; private set; } - [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender) + private Bindable backgroundBlurLevel { get; set; } = new BindableFloat(); + + private void applyBackgroundBlur(float v) { + ApplyToBackground(background => + { + background.IgnoreUserSettings.Value = true; + background.BlurAmount.Value = v * BACKGROUND_BLUR; + }); + } + private void applyBackgroundBlur(ValueChangedEvent v) + { + applyBackgroundBlur(v.NewValue); + } + + [BackgroundDependencyLoader(true)] + private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config) + { + backgroundBlurLevel = config.GetBindable(OsuSetting.BeatmapSelectionBlurLevel); + LoadComponentAsync(Carousel = new BeatmapCarousel { AllowSelection = false, // delay any selection until our bindables are ready to make a good choice. @@ -549,6 +567,9 @@ namespace osu.Game.Screens.Select { base.OnEntering(e); + backgroundBlurLevel.ValueChanged += applyBackgroundBlur; + applyBackgroundBlur(backgroundBlurLevel.Value); + this.FadeInFromZero(250); FilterControl.Activate(); @@ -596,6 +617,8 @@ namespace osu.Game.Screens.Select public override void OnResuming(ScreenTransitionEvent e) { base.OnResuming(e); + backgroundBlurLevel.ValueChanged += applyBackgroundBlur; + applyBackgroundBlur(backgroundBlurLevel.Value); // required due to https://github.com/ppy/osu-framework/issues/3218 ModSelect.SelectedMods.Disabled = false; @@ -641,6 +664,8 @@ namespace osu.Game.Screens.Select // Without this, it's possible for a transfer to happen while we are not the current screen. transferRulesetValue(); + backgroundBlurLevel.ValueChanged -= applyBackgroundBlur; + ModSelect.SelectedMods.UnbindFrom(selectedMods); playExitingTransition(); @@ -649,6 +674,8 @@ namespace osu.Game.Screens.Select public override bool OnExiting(ScreenExitEvent e) { + backgroundBlurLevel.ValueChanged -= applyBackgroundBlur; + if (base.OnExiting(e)) return true; @@ -742,7 +769,7 @@ namespace osu.Game.Screens.Select ApplyToBackground(backgroundModeBeatmap => { backgroundModeBeatmap.Beatmap = beatmap; - backgroundModeBeatmap.BlurAmount.Value = BACKGROUND_BLUR; + backgroundModeBeatmap.BlurAmount.Value = backgroundBlurLevel.Value * BACKGROUND_BLUR; backgroundModeBeatmap.FadeColour(Color4.White, 250); }); From f13a5465ba38e91be20e4cdb3d811398e01b8430 Mon Sep 17 00:00:00 2001 From: Jeremiah DECOMBE Date: Mon, 23 Jan 2023 23:07:50 +0100 Subject: [PATCH 02/24] variable naming and loc modifications --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- osu.Game/Localisation/UserInterfaceStrings.cs | 5 ++--- .../Settings/Sections/UserInterface/SongSelectSettings.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 2b7c2102d4..f7b84527b5 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -60,7 +60,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.ToolbarClockDisplayMode, ToolbarClockDisplayMode.Full); - SetDefault(OsuSetting.BeatmapSelectionBlurLevel, 1f, 0, 1f, 0.01f); + SetDefault(OsuSetting.BeatmapSelectionBackgoundBlurLevel, 1f, 0, 1f, 0.01f); // Online settings SetDefault(OsuSetting.Username, string.Empty); @@ -341,7 +341,7 @@ namespace osu.Game.Configuration ChatDisplayHeight, BeatmapListingCardSize, ToolbarClockDisplayMode, - BeatmapSelectionBlurLevel, + BeatmapSelectionBackgoundBlurLevel, Version, ShowFirstRunSetup, ShowConvertedBeatmaps, diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index 0bf7dae403..9abb3aaddc 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -110,10 +110,9 @@ namespace osu.Game.Localisation public static LocalisableString ModSelectHotkeyStyle => new TranslatableString(getKey(@"mod_select_hotkey_style"), @"Mod select hotkey style"); /// - /// "Beatmap selection blur level" + /// "Song select background blur" /// - public static LocalisableString BeatmapSelectionBlurLevel => new TranslatableString(getKey(@"beatmap_selection_blur_level"), @"Beatmap selection blur level"); - + public static LocalisableString BeatmapSelectionBackgroundBlurLevel => new TranslatableString(getKey(@"beatmap_selection_background_blur_level"), @"Song select background blur"); /// /// "no limit" diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 828119981f..f0b2721153 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -45,8 +45,8 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface }, new SettingsSlider { - LabelText = UserInterfaceStrings.BeatmapSelectionBlurLevel, - Current = config.GetBindable(OsuSetting.BeatmapSelectionBlurLevel) + LabelText = UserInterfaceStrings.BeatmapSelectionBackgroundBlurLevel, + Current = config.GetBindable(OsuSetting.BeatmapSelectionBackgoundBlurLevel) } }; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bd1498f0dd..bf6e433a8e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -143,7 +143,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader(true)] private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config) { - backgroundBlurLevel = config.GetBindable(OsuSetting.BeatmapSelectionBlurLevel); + backgroundBlurLevel = config.GetBindable(OsuSetting.BeatmapSelectionBackgoundBlurLevel); LoadComponentAsync(Carousel = new BeatmapCarousel { From 26adc28943a802ab924e21f3da02b7a46db083e9 Mon Sep 17 00:00:00 2001 From: Jeremiah DECOMBE Date: Mon, 23 Jan 2023 23:15:37 +0100 Subject: [PATCH 03/24] missing blank line between methods --- osu.Game/Screens/Select/SongSelect.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bf6e433a8e..c43344d963 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -135,6 +135,7 @@ namespace osu.Game.Screens.Select background.BlurAmount.Value = v * BACKGROUND_BLUR; }); } + private void applyBackgroundBlur(ValueChangedEvent v) { applyBackgroundBlur(v.NewValue); From b573e42cc25575588275eec428366fbffb1cc76b Mon Sep 17 00:00:00 2001 From: Jeremiah DECOMBE Date: Tue, 24 Jan 2023 00:08:11 +0100 Subject: [PATCH 04/24] BeatmapSelectionBackgroundBlurLevel renamed to SongSelectBackgroundBlurLevel --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- osu.Game/Localisation/UserInterfaceStrings.cs | 2 +- .../Settings/Sections/UserInterface/SongSelectSettings.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index f7b84527b5..d26fc2ec43 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -60,7 +60,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.ToolbarClockDisplayMode, ToolbarClockDisplayMode.Full); - SetDefault(OsuSetting.BeatmapSelectionBackgoundBlurLevel, 1f, 0, 1f, 0.01f); + SetDefault(OsuSetting.SongSelectBackgoundBlurLevel, 1f, 0, 1f, 0.01f); // Online settings SetDefault(OsuSetting.Username, string.Empty); @@ -341,7 +341,7 @@ namespace osu.Game.Configuration ChatDisplayHeight, BeatmapListingCardSize, ToolbarClockDisplayMode, - BeatmapSelectionBackgoundBlurLevel, + SongSelectBackgoundBlurLevel, Version, ShowFirstRunSetup, ShowConvertedBeatmaps, diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index 9abb3aaddc..5e4c4dc8ed 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -112,7 +112,7 @@ namespace osu.Game.Localisation /// /// "Song select background blur" /// - public static LocalisableString BeatmapSelectionBackgroundBlurLevel => new TranslatableString(getKey(@"beatmap_selection_background_blur_level"), @"Song select background blur"); + public static LocalisableString SongSelectBackgroundBlurLevel => new TranslatableString(getKey(@"song_select_background_blur_level"), @"Song select background blur"); /// /// "no limit" diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index f0b2721153..3228ebfe44 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -45,8 +45,8 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface }, new SettingsSlider { - LabelText = UserInterfaceStrings.BeatmapSelectionBackgroundBlurLevel, - Current = config.GetBindable(OsuSetting.BeatmapSelectionBackgoundBlurLevel) + LabelText = UserInterfaceStrings.SongSelectBackgroundBlurLevel, + Current = config.GetBindable(OsuSetting.SongSelectBackgoundBlurLevel) } }; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index c43344d963..b756ac2a98 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -144,7 +144,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader(true)] private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config) { - backgroundBlurLevel = config.GetBindable(OsuSetting.BeatmapSelectionBackgoundBlurLevel); + backgroundBlurLevel = config.GetBindable(OsuSetting.SongSelectBackgoundBlurLevel); LoadComponentAsync(Carousel = new BeatmapCarousel { From c1876aac887a238d477892c806314f6b50d33adc Mon Sep 17 00:00:00 2001 From: Jeremiah DECOMBE Date: Tue, 24 Jan 2023 00:36:38 +0100 Subject: [PATCH 05/24] removing parameter name abbreviations --- osu.Game/Screens/Select/SongSelect.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index b756ac2a98..eab0620255 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -127,18 +127,18 @@ namespace osu.Game.Screens.Select private Bindable backgroundBlurLevel { get; set; } = new BindableFloat(); - private void applyBackgroundBlur(float v) + private void applyBackgroundBlur(float blurLevel) { ApplyToBackground(background => { background.IgnoreUserSettings.Value = true; - background.BlurAmount.Value = v * BACKGROUND_BLUR; + background.BlurAmount.Value = blurLevel * BACKGROUND_BLUR; }); } - private void applyBackgroundBlur(ValueChangedEvent v) + private void applyBackgroundBlur(ValueChangedEvent blurLevelValueChange) { - applyBackgroundBlur(v.NewValue); + applyBackgroundBlur(blurLevelValueChange.NewValue); } [BackgroundDependencyLoader(true)] From 04995b66da5f6abb71ae51eef0628915c1b7df41 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 24 Jan 2023 07:09:25 +0300 Subject: [PATCH 06/24] Add seed slider to Triangles test sceen --- osu.Game.Tests/Visual/Background/TestSceneTrianglesBackground.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/Background/TestSceneTrianglesBackground.cs b/osu.Game.Tests/Visual/Background/TestSceneTrianglesBackground.cs index d3cdf928e8..8a5489f476 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneTrianglesBackground.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneTrianglesBackground.cs @@ -35,6 +35,7 @@ namespace osu.Game.Tests.Visual.Background base.LoadComplete(); AddSliderStep("Triangle scale", 0f, 10f, 1f, s => triangles.TriangleScale = s); + AddSliderStep("Seed", 0, 1000, 0, s => triangles.Reset(s)); } } } From 04c96355cb682610e14be0b9731b4fba3489f685 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 24 Jan 2023 07:38:42 +0300 Subject: [PATCH 07/24] Use TriangleBorder shader to draw triangles --- osu.Game/Graphics/Backgrounds/Triangles.cs | 40 ++++++++++------------ 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 94397f7ffb..d9dff1574f 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -31,12 +31,6 @@ namespace osu.Game.Graphics.Backgrounds /// private const float equilateral_triangle_ratio = 0.866f; - /// - /// How many screen-space pixels are smoothed over. - /// Same behavior as Sprite's EdgeSmoothness. - /// - private const float edge_smoothness = 1; - private Color4 colourLight = Color4.White; public Color4 ColourLight @@ -115,7 +109,7 @@ namespace osu.Game.Graphics.Backgrounds private void load(IRenderer renderer, ShaderManager shaders) { texture = renderer.WhitePixel; - shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE); + shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, "TriangleBorder"); } protected override void LoadComplete() @@ -252,14 +246,17 @@ namespace osu.Game.Graphics.Backgrounds private class TrianglesDrawNode : DrawNode { + private float fill = 1f; + protected new Triangles Source => (Triangles)base.Source; private IShader shader; private Texture texture; private readonly List parts = new List(); - private Vector2 size; + private readonly Vector2 triangleSize = new Vector2(1f, equilateral_triangle_ratio) * triangle_size; + private Vector2 size; private IVertexBatch vertexBatch; public TrianglesDrawNode(Triangles source) @@ -290,29 +287,28 @@ namespace osu.Game.Graphics.Backgrounds } shader.Bind(); - - Vector2 localInflationAmount = edge_smoothness * DrawInfo.MatrixInverse.ExtractScale().Xy; + shader.GetUniform("thickness").UpdateValue(ref fill); foreach (TriangleParticle particle in parts) { - var offset = triangle_size * new Vector2(particle.Scale * 0.5f, particle.Scale * equilateral_triangle_ratio); + Vector2 relativeSize = Vector2.Divide(triangleSize * particle.Scale, size); - var triangle = new Triangle( - Vector2Extensions.Transform(particle.Position * size, DrawInfo.Matrix), - Vector2Extensions.Transform(particle.Position * size + offset, DrawInfo.Matrix), - Vector2Extensions.Transform(particle.Position * size + new Vector2(-offset.X, offset.Y), DrawInfo.Matrix) + Vector2 topLeft = particle.Position - new Vector2(relativeSize.X * 0.5f, 0f); + Vector2 topRight = topLeft + new Vector2(relativeSize.X, 0f); + Vector2 bottomLeft = topLeft + new Vector2(0f, relativeSize.Y); + Vector2 bottomRight = bottomLeft + new Vector2(relativeSize.X, 0f); + + var drawQuad = new Quad( + Vector2Extensions.Transform(topLeft * size, DrawInfo.Matrix), + Vector2Extensions.Transform(topRight * size, DrawInfo.Matrix), + Vector2Extensions.Transform(bottomLeft * size, DrawInfo.Matrix), + Vector2Extensions.Transform(bottomRight * size, DrawInfo.Matrix) ); ColourInfo colourInfo = DrawColourInfo.Colour; colourInfo.ApplyChild(particle.Colour); - renderer.DrawTriangle( - texture, - triangle, - colourInfo, - null, - vertexBatch.AddAction, - Vector2.Divide(localInflationAmount, new Vector2(2 * offset.X, offset.Y))); + renderer.DrawQuad(texture, drawQuad, colourInfo, vertexAction: vertexBatch.AddAction); } shader.Unbind(); From d783998c81f58bd1548e4f6569aca886868845e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9miah=20D=C3=89COMBE?= Date: Tue, 24 Jan 2023 09:09:05 +0100 Subject: [PATCH 08/24] using BindValueChanged and IsCurrentScreen for setting binding --- osu.Game/Screens/Select/SongSelect.cs | 34 +++++++++------------------ 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index eab0620255..dbd948ff86 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -127,24 +127,21 @@ namespace osu.Game.Screens.Select private Bindable backgroundBlurLevel { get; set; } = new BindableFloat(); - private void applyBackgroundBlur(float blurLevel) - { - ApplyToBackground(background => - { - background.IgnoreUserSettings.Value = true; - background.BlurAmount.Value = blurLevel * BACKGROUND_BLUR; - }); - } - - private void applyBackgroundBlur(ValueChangedEvent blurLevelValueChange) - { - applyBackgroundBlur(blurLevelValueChange.NewValue); - } - [BackgroundDependencyLoader(true)] private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config) { backgroundBlurLevel = config.GetBindable(OsuSetting.SongSelectBackgoundBlurLevel); + backgroundBlurLevel.BindValueChanged(e => + { + if (this.IsCurrentScreen()) + { + ApplyToBackground(background => + { + background.IgnoreUserSettings.Value = true; + background.BlurAmount.Value = e.NewValue * BACKGROUND_BLUR; + }); + } + }, true); LoadComponentAsync(Carousel = new BeatmapCarousel { @@ -568,9 +565,6 @@ namespace osu.Game.Screens.Select { base.OnEntering(e); - backgroundBlurLevel.ValueChanged += applyBackgroundBlur; - applyBackgroundBlur(backgroundBlurLevel.Value); - this.FadeInFromZero(250); FilterControl.Activate(); @@ -618,8 +612,6 @@ namespace osu.Game.Screens.Select public override void OnResuming(ScreenTransitionEvent e) { base.OnResuming(e); - backgroundBlurLevel.ValueChanged += applyBackgroundBlur; - applyBackgroundBlur(backgroundBlurLevel.Value); // required due to https://github.com/ppy/osu-framework/issues/3218 ModSelect.SelectedMods.Disabled = false; @@ -665,8 +657,6 @@ namespace osu.Game.Screens.Select // Without this, it's possible for a transfer to happen while we are not the current screen. transferRulesetValue(); - backgroundBlurLevel.ValueChanged -= applyBackgroundBlur; - ModSelect.SelectedMods.UnbindFrom(selectedMods); playExitingTransition(); @@ -675,8 +665,6 @@ namespace osu.Game.Screens.Select public override bool OnExiting(ScreenExitEvent e) { - backgroundBlurLevel.ValueChanged -= applyBackgroundBlur; - if (base.OnExiting(e)) return true; From 7ca2a431e655bea849184e937819b384eb9cdfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9miah=20D=C3=89COMBE?= Date: Tue, 24 Jan 2023 09:19:53 +0100 Subject: [PATCH 09/24] changing song select background blur setting to boolean --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- .../Settings/Sections/UserInterface/SongSelectSettings.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index d26fc2ec43..fff5dc62c6 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -60,7 +60,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.ToolbarClockDisplayMode, ToolbarClockDisplayMode.Full); - SetDefault(OsuSetting.SongSelectBackgoundBlurLevel, 1f, 0, 1f, 0.01f); + SetDefault(OsuSetting.SongSelectBackgoundBlur, true); // Online settings SetDefault(OsuSetting.Username, string.Empty); @@ -341,7 +341,7 @@ namespace osu.Game.Configuration ChatDisplayHeight, BeatmapListingCardSize, ToolbarClockDisplayMode, - SongSelectBackgoundBlurLevel, + SongSelectBackgoundBlur, Version, ShowFirstRunSetup, ShowConvertedBeatmaps, diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 3228ebfe44..ab5a3a1280 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -43,10 +43,10 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface Current = config.GetBindable(OsuSetting.ModSelectHotkeyStyle), ClassicDefault = ModSelectHotkeyStyle.Classic }, - new SettingsSlider + new SettingsCheckbox { LabelText = UserInterfaceStrings.SongSelectBackgroundBlurLevel, - Current = config.GetBindable(OsuSetting.SongSelectBackgoundBlurLevel) + Current = config.GetBindable(OsuSetting.SongSelectBackgoundBlur) } }; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index dbd948ff86..bbb88052aa 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -125,12 +125,12 @@ namespace osu.Game.Screens.Select [Resolved] internal IOverlayManager? OverlayManager { get; private set; } - private Bindable backgroundBlurLevel { get; set; } = new BindableFloat(); + private Bindable backgroundBlurLevel { get; set; } = new BindableBool(); [BackgroundDependencyLoader(true)] private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config) { - backgroundBlurLevel = config.GetBindable(OsuSetting.SongSelectBackgoundBlurLevel); + backgroundBlurLevel = config.GetBindable(OsuSetting.SongSelectBackgoundBlur); backgroundBlurLevel.BindValueChanged(e => { if (this.IsCurrentScreen()) @@ -138,7 +138,7 @@ namespace osu.Game.Screens.Select ApplyToBackground(background => { background.IgnoreUserSettings.Value = true; - background.BlurAmount.Value = e.NewValue * BACKGROUND_BLUR; + background.BlurAmount.Value = e.NewValue ? BACKGROUND_BLUR : 0; }); } }, true); @@ -758,7 +758,7 @@ namespace osu.Game.Screens.Select ApplyToBackground(backgroundModeBeatmap => { backgroundModeBeatmap.Beatmap = beatmap; - backgroundModeBeatmap.BlurAmount.Value = backgroundBlurLevel.Value * BACKGROUND_BLUR; + backgroundModeBeatmap.BlurAmount.Value = backgroundBlurLevel.Value ? BACKGROUND_BLUR : 0f; backgroundModeBeatmap.FadeColour(Color4.White, 250); }); From 3a47be6e002eecbea52c443741fad75041261f93 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jan 2023 17:43:14 +0900 Subject: [PATCH 10/24] Fix argon hit circles occasionally going missing during editor seeking --- .../Skinning/Argon/ArgonMainCirclePiece.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs index db458ec48a..a62efa96bf 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs @@ -64,21 +64,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon outerGradient = new Circle // renders the outer bright gradient { Size = new Vector2(OUTER_GRADIENT_SIZE), - Alpha = 1, Anchor = Anchor.Centre, Origin = Anchor.Centre, }, innerGradient = new Circle // renders the inner bright gradient { Size = new Vector2(INNER_GRADIENT_SIZE), - Alpha = 1, Anchor = Anchor.Centre, Origin = Anchor.Centre, }, innerFill = new Circle // renders the inner dark fill { Size = new Vector2(INNER_FILL_SIZE), - Alpha = 1, Anchor = Anchor.Centre, Origin = Anchor.Centre, }, @@ -123,14 +120,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon // Accent colour may be changed many times during a paused gameplay state. // Schedule the change to avoid transforms piling up. - Scheduler.AddOnce(updateStateTransforms); + Scheduler.AddOnce(() => + { + updateStateTransforms(drawableObject, drawableObject.State.Value); + + ApplyTransformsAt(double.MinValue, true); + ClearTransformsAfter(double.MinValue, true); + }); }, true); drawableObject.ApplyCustomUpdateState += updateStateTransforms; } - private void updateStateTransforms() => updateStateTransforms(drawableObject, drawableObject.State.Value); - private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state) { using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) From e0a7559d851fca88f92d8866cb54a08f8cd0f6b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9miah=20D=C3=89COMBE?= Date: Tue, 24 Jan 2023 09:55:08 +0100 Subject: [PATCH 11/24] variable naming + loc --- osu.Game/Localisation/UserInterfaceStrings.cs | 4 ++-- .../Settings/Sections/UserInterface/SongSelectSettings.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index 5e4c4dc8ed..fb9eeeb3de 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -110,9 +110,9 @@ namespace osu.Game.Localisation public static LocalisableString ModSelectHotkeyStyle => new TranslatableString(getKey(@"mod_select_hotkey_style"), @"Mod select hotkey style"); /// - /// "Song select background blur" + /// "Background blur" /// - public static LocalisableString SongSelectBackgroundBlurLevel => new TranslatableString(getKey(@"song_select_background_blur_level"), @"Song select background blur"); + public static LocalisableString BackgroundBlurLevel => new TranslatableString(getKey(@"background_blur_level"), @"Background blur"); /// /// "no limit" diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index ab5a3a1280..11f7976842 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface }, new SettingsCheckbox { - LabelText = UserInterfaceStrings.SongSelectBackgroundBlurLevel, + LabelText = UserInterfaceStrings.BackgroundBlurLevel, Current = config.GetBindable(OsuSetting.SongSelectBackgoundBlur) } }; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bbb88052aa..505f932bff 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -125,13 +125,13 @@ namespace osu.Game.Screens.Select [Resolved] internal IOverlayManager? OverlayManager { get; private set; } - private Bindable backgroundBlurLevel { get; set; } = new BindableBool(); + private Bindable configBackgroundBlur { get; set; } = new BindableBool(); [BackgroundDependencyLoader(true)] private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config) { - backgroundBlurLevel = config.GetBindable(OsuSetting.SongSelectBackgoundBlur); - backgroundBlurLevel.BindValueChanged(e => + configBackgroundBlur = config.GetBindable(OsuSetting.SongSelectBackgoundBlur); + configBackgroundBlur.BindValueChanged(e => { if (this.IsCurrentScreen()) { @@ -758,7 +758,7 @@ namespace osu.Game.Screens.Select ApplyToBackground(backgroundModeBeatmap => { backgroundModeBeatmap.Beatmap = beatmap; - backgroundModeBeatmap.BlurAmount.Value = backgroundBlurLevel.Value ? BACKGROUND_BLUR : 0f; + backgroundModeBeatmap.BlurAmount.Value = configBackgroundBlur.Value ? BACKGROUND_BLUR : 0f; backgroundModeBeatmap.FadeColour(Color4.White, 250); }); From acb42f7d1265fe8ab7a72d302a4af6d7e12d7bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9miah=20D=C3=89COMBE?= Date: Tue, 24 Jan 2023 10:18:00 +0100 Subject: [PATCH 12/24] reusing gameplay background blur loc song select background blur --- .../Settings/Sections/UserInterface/SongSelectSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 11f7976842..d40d24a528 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface }, new SettingsCheckbox { - LabelText = UserInterfaceStrings.BackgroundBlurLevel, + LabelText = GameplaySettingsStrings.BackgroundBlur, Current = config.GetBindable(OsuSetting.SongSelectBackgoundBlur) } }; From ff22a91d5287aaf19b7a8f5f80dfba2e7b75b92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 31 Dec 2022 19:36:17 +0100 Subject: [PATCH 13/24] Move user cover lower down --- .../Profile/Header/TopHeaderContainer.cs | 165 +++++++++++------- osu.Game/Overlays/Profile/ProfileHeader.cs | 35 +--- 2 files changed, 99 insertions(+), 101 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 1fe39cb570..270be7cdf4 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Overlays.Profile.Header.Components; +using osu.Game.Users; using osu.Game.Users.Drawables; using osuTK; @@ -28,6 +29,7 @@ namespace osu.Game.Overlays.Profile.Header [Resolved] private IAPIProvider api { get; set; } = null!; + private UserCoverBackground cover = null!; private SupporterIcon supporterTag = null!; private UpdateableAvatar avatar = null!; private OsuSpriteText usernameText = null!; @@ -40,7 +42,8 @@ namespace osu.Game.Overlays.Profile.Header [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { - Height = 150; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; InternalChildren = new Drawable[] { @@ -51,52 +54,73 @@ namespace osu.Game.Overlays.Profile.Header }, new FillFlowContainer { - Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, - Height = avatar_size, - AutoSizeAxes = Axes.X, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, Children = new Drawable[] { - avatar = new UpdateableAvatar(isInteractive: false, showGuestOnNull: false) + cover = new ProfileCoverBackground { - Size = new Vector2(avatar_size), - Masking = true, - CornerRadius = avatar_size * 0.25f, + RelativeSizeAxes = Axes.X, + Height = 250, }, - new OsuContextMenuContainer + new FillFlowContainer { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Child = new Container + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Padding = new MarginPadding { Left = 10 }, - Children = new Drawable[] + Left = UserProfileOverlay.CONTENT_X_MARGIN, + Vertical = 10 + }, + Height = avatar_size, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + avatar = new UpdateableAvatar(isInteractive: false, showGuestOnNull: false) { - new FillFlowContainer + Size = new Vector2(avatar_size), + Masking = true, + CornerRadius = avatar_size * 0.25f, + }, + new OsuContextMenuContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Child = new Container { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Padding = new MarginPadding { Left = 10 }, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5), + Direction = FillDirection.Vertical, Children = new Drawable[] { - usernameText = new OsuSpriteText + new FillFlowContainer { - Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular) + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + usernameText = new OsuSpriteText + { + Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular) + }, + openUserExternally = new ExternalLinkButton + { + Margin = new MarginPadding { Left = 5 }, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }, + } }, - openUserExternally = new ExternalLinkButton + titleText = new OsuSpriteText { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Regular) }, groupBadgeFlow = new GroupBadgeFlow { @@ -105,54 +129,50 @@ namespace osu.Game.Overlays.Profile.Header } } }, - titleText = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 18, weight: FontWeight.Regular) - }, - } - }, - new FillFlowContainer - { - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Direction = FillDirection.Vertical, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - supporterTag = new SupporterIcon - { - Height = 20, - Margin = new MarginPadding { Top = 5 } - }, - new Box - { - RelativeSizeAxes = Axes.X, - Height = 1.5f, - Margin = new MarginPadding { Top = 10 }, - Colour = colourProvider.Light1, - }, new FillFlowContainer { + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Top = 5 }, - Direction = FillDirection.Horizontal, Children = new Drawable[] { - userFlag = new UpdateableFlag + supporterTag = new SupporterIcon { - Size = new Vector2(28, 20), - ShowPlaceholderOnUnknown = false, + Height = 20, + Margin = new MarginPadding { Top = 5 } }, - userCountryText = new OsuSpriteText + new Box { - Font = OsuFont.GetFont(size: 17.5f, weight: FontWeight.Regular), - Margin = new MarginPadding { Left = 10 }, - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, + RelativeSizeAxes = Axes.X, + Height = 1.5f, + Margin = new MarginPadding { Top = 10 }, Colour = colourProvider.Light1, - } + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Top = 5 }, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + userFlag = new UpdateableFlag + { + Size = new Vector2(28, 20), + ShowPlaceholderOnUnknown = false, + }, + userCountryText = new OsuSpriteText + { + Font = OsuFont.GetFont(size: 17.5f, weight: FontWeight.Regular), + Margin = new MarginPadding { Left = 10 }, + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + Colour = colourProvider.Light1, + } + } + }, } - }, + } } } } @@ -169,6 +189,7 @@ namespace osu.Game.Overlays.Profile.Header { var user = data?.User; + cover.User = user; avatar.User = user; usernameText.Text = user?.Username ?? string.Empty; openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}"; @@ -179,5 +200,15 @@ namespace osu.Game.Overlays.Profile.Header titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff"); groupBadgeFlow.User.Value = user; } + + private partial class ProfileCoverBackground : UserCoverBackground + { + protected override double LoadDelay => 0; + + public ProfileCoverBackground() + { + Masking = true; + } + } } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index c559a1c102..67b723b7e6 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -3,23 +3,17 @@ using System.Diagnostics; using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Game.Overlays.Profile.Header; using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; namespace osu.Game.Overlays.Profile { public partial class ProfileHeader : TabControlOverlayHeader { - private UserCoverBackground coverContainer = null!; - public Bindable User = new Bindable(); private CentreHeaderContainer centreHeaderContainer; @@ -29,8 +23,6 @@ namespace osu.Game.Overlays.Profile { ContentSidePadding = UserProfileOverlay.CONTENT_X_MARGIN; - User.ValueChanged += e => updateDisplay(e.NewValue); - TabControl.AddItem(LayoutStrings.HeaderUsersShow); // todo: pending implementation. @@ -41,25 +33,7 @@ namespace osu.Game.Overlays.Profile Debug.Assert(detailHeaderContainer != null); } - protected override Drawable CreateBackground() => - new Container - { - RelativeSizeAxes = Axes.X, - Height = 150, - Masking = true, - Children = new Drawable[] - { - coverContainer = new ProfileCoverBackground - { - RelativeSizeAxes = Axes.Both, - }, - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("222").Opacity(0.8f), Color4Extensions.FromHex("222").Opacity(0.2f)) - }, - } - }; + protected override Drawable CreateBackground() => Empty(); protected override Drawable CreateContent() => new FillFlowContainer { @@ -103,8 +77,6 @@ namespace osu.Game.Overlays.Profile User = { BindTarget = User } }; - private void updateDisplay(UserProfileData? user) => coverContainer.User = user?.User; - private partial class ProfileHeaderTitle : OverlayTitle { public ProfileHeaderTitle() @@ -113,10 +85,5 @@ namespace osu.Game.Overlays.Profile IconTexture = "Icons/Hexacons/profile"; } } - - private partial class ProfileCoverBackground : UserCoverBackground - { - protected override double LoadDelay => 0; - } } } From ef7812412b5eadf301de7aa2d7e090f450d76d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 31 Dec 2022 19:58:58 +0100 Subject: [PATCH 14/24] Update top header container appearance --- .../Online/TestSceneUserProfileOverlay.cs | 5 +- .../Profile/Header/TopHeaderContainer.cs | 114 ++++++++---------- 2 files changed, 54 insertions(+), 65 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index fc8c2c0b6e..9aaa616c04 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"Somebody", Id = 1, - CountryCode = CountryCode.Unknown, + CountryCode = CountryCode.JP, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", JoinDate = DateTimeOffset.Now.AddDays(-1), LastVisit = DateTimeOffset.Now, @@ -143,7 +143,8 @@ namespace osu.Game.Tests.Visual.Online { Available = 10, Total = 50 - } + }, + SupportLevel = 2, }; } } diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 270be7cdf4..a71db23989 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -7,6 +7,7 @@ using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -22,7 +23,7 @@ namespace osu.Game.Overlays.Profile.Header { public partial class TopHeaderContainer : CompositeDrawable { - private const float avatar_size = 110; + private const float avatar_size = 120; public readonly Bindable User = new Bindable(); @@ -67,60 +68,66 @@ namespace osu.Game.Overlays.Profile.Header new FillFlowContainer { Direction = FillDirection.Horizontal, - Margin = new MarginPadding + Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 10 }, - Height = avatar_size, + Spacing = new Vector2(20, 0), + Height = 85, RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, Children = new Drawable[] { avatar = new UpdateableAvatar(isInteractive: false, showGuestOnNull: false) { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, Size = new Vector2(avatar_size), Masking = true, CornerRadius = avatar_size * 0.25f, + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Offset = new Vector2(0, 1), + Radius = 3, + Colour = Colour4.Black.Opacity(0.25f), + } }, new OsuContextMenuContainer { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, - Child = new Container + Child = new FillFlowContainer { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Padding = new MarginPadding { Left = 10 }, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), Children = new Drawable[] { - new FillFlowContainer + usernameText = new OsuSpriteText { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - usernameText = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular) - }, - openUserExternally = new ExternalLinkButton - { - Margin = new MarginPadding { Left = 5 }, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - }, - } + Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular) }, - titleText = new OsuSpriteText + supporterTag = new SupporterIcon { - Font = OsuFont.GetFont(size: 18, weight: FontWeight.Regular) + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Height = 15, + }, + openUserExternally = new ExternalLinkButton + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, }, groupBadgeFlow = new GroupBadgeFlow { @@ -129,52 +136,33 @@ namespace osu.Game.Overlays.Profile.Header } } }, + titleText = new OsuSpriteText + { + Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular), + Margin = new MarginPadding { Bottom = 5 } + }, new FillFlowContainer { - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, Children = new Drawable[] { - supporterTag = new SupporterIcon + userFlag = new UpdateableFlag { - Height = 20, - Margin = new MarginPadding { Top = 5 } + Size = new Vector2(28, 20), + ShowPlaceholderOnUnknown = false, }, - new Box + userCountryText = new OsuSpriteText { - RelativeSizeAxes = Axes.X, - Height = 1.5f, - Margin = new MarginPadding { Top = 10 }, - Colour = colourProvider.Light1, - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Top = 5 }, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - userFlag = new UpdateableFlag - { - Size = new Vector2(28, 20), - ShowPlaceholderOnUnknown = false, - }, - userCountryText = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 17.5f, weight: FontWeight.Regular), - Margin = new MarginPadding { Left = 10 }, - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - Colour = colourProvider.Light1, - } - } - }, + Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular), + Margin = new MarginPadding { Left = 5 }, + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + } } - } + }, } - } + }, } } } From e74176e5bd49fdf2462bf93fbf81225c5b7bb5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 31 Dec 2022 20:09:49 +0100 Subject: [PATCH 15/24] Add cover toggle button --- ...dDetailsButton.cs => ToggleCoverButton.cs} | 21 +- .../Profile/Header/TopHeaderContainer.cs | 198 ++++++++++-------- 2 files changed, 117 insertions(+), 102 deletions(-) rename osu.Game/Overlays/Profile/Header/Components/{ExpandDetailsButton.cs => ToggleCoverButton.cs} (68%) diff --git a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs b/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs similarity index 68% rename from osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs rename to osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs index e7a83c95d8..9ae529f3ae 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; @@ -15,11 +14,11 @@ using osuTK; namespace osu.Game.Overlays.Profile.Header.Components { - public partial class ExpandDetailsButton : ProfileHeaderButton + public partial class ToggleCoverButton : ProfileHeaderButton { - public readonly BindableBool DetailsVisible = new BindableBool(); + public readonly BindableBool CoverVisible = new BindableBool(); - public override LocalisableString TooltipText => DetailsVisible.Value ? CommonStrings.ButtonsCollapse : CommonStrings.ButtonsExpand; + public override LocalisableString TooltipText => CoverVisible.Value ? UsersStrings.ShowCoverTo0 : UsersStrings.ShowCoverTo1; private SpriteIcon icon = null!; private Sample? sampleOpen; @@ -27,12 +26,12 @@ namespace osu.Game.Overlays.Profile.Header.Components protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(); - public ExpandDetailsButton() + public ToggleCoverButton() { Action = () => { - DetailsVisible.Toggle(); - (DetailsVisible.Value ? sampleOpen : sampleClose)?.Play(); + CoverVisible.Toggle(); + (CoverVisible.Value ? sampleOpen : sampleClose)?.Play(); }; } @@ -40,19 +39,21 @@ namespace osu.Game.Overlays.Profile.Header.Components private void load(OverlayColourProvider colourProvider, AudioManager audio) { IdleColour = colourProvider.Background2; - HoverColour = colourProvider.Background2.Lighten(0.2f); + HoverColour = colourProvider.Background1; sampleOpen = audio.Samples.Get(@"UI/dropdown-open"); sampleClose = audio.Samples.Get(@"UI/dropdown-close"); + AutoSizeAxes = Axes.None; + Size = new Vector2(30); Child = icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(20, 12) + Size = new Vector2(10.5f, 12) }; - DetailsVisible.BindValueChanged(visible => updateState(visible.NewValue), true); + CoverVisible.BindValueChanged(visible => updateState(visible.NewValue), true); } private void updateState(bool detailsVisible) => icon.Icon = detailsVisible ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown; diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index a71db23989..0204800326 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -65,108 +65,122 @@ namespace osu.Game.Overlays.Profile.Header RelativeSizeAxes = Axes.X, Height = 250, }, - new FillFlowContainer + new Container { - Direction = FillDirection.Horizontal, - Padding = new MarginPadding - { - Left = UserProfileOverlay.CONTENT_X_MARGIN, - Vertical = 10 - }, - Spacing = new Vector2(20, 0), - Height = 85, RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Children = new Drawable[] { - avatar = new UpdateableAvatar(isInteractive: false, showGuestOnNull: false) + new FillFlowContainer { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Size = new Vector2(avatar_size), - Masking = true, - CornerRadius = avatar_size * 0.25f, - EdgeEffect = new EdgeEffectParameters + Direction = FillDirection.Horizontal, + Padding = new MarginPadding { - Type = EdgeEffectType.Shadow, - Offset = new Vector2(0, 1), - Radius = 3, - Colour = Colour4.Black.Opacity(0.25f), + Left = UserProfileOverlay.CONTENT_X_MARGIN, + Vertical = 10 + }, + Spacing = new Vector2(20, 0), + Height = 85, + RelativeSizeAxes = Axes.X, + Children = new Drawable[] + { + avatar = new UpdateableAvatar(isInteractive: false, showGuestOnNull: false) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Size = new Vector2(avatar_size), + Masking = true, + CornerRadius = avatar_size * 0.25f, + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Offset = new Vector2(0, 1), + Radius = 3, + Colour = Colour4.Black.Opacity(0.25f), + } + }, + new OsuContextMenuContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), + Children = new Drawable[] + { + usernameText = new OsuSpriteText + { + Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular) + }, + supporterTag = new SupporterIcon + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Height = 15, + }, + openUserExternally = new ExternalLinkButton + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }, + groupBadgeFlow = new GroupBadgeFlow + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }, + } + }, + titleText = new OsuSpriteText + { + Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular), + Margin = new MarginPadding { Bottom = 5 } + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + userFlag = new UpdateableFlag + { + Size = new Vector2(28, 20), + ShowPlaceholderOnUnknown = false, + }, + userCountryText = new OsuSpriteText + { + Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular), + Margin = new MarginPadding { Left = 5 }, + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + } + } + }, + } + }, + }, } }, - new OsuContextMenuContainer + new ToggleCoverButton { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Child = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5, 0), - Children = new Drawable[] - { - usernameText = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular) - }, - supporterTag = new SupporterIcon - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Height = 15, - }, - openUserExternally = new ExternalLinkButton - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - }, - groupBadgeFlow = new GroupBadgeFlow - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - } - } - }, - titleText = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular), - Margin = new MarginPadding { Bottom = 5 } - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - userFlag = new UpdateableFlag - { - Size = new Vector2(28, 20), - ShowPlaceholderOnUnknown = false, - }, - userCountryText = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular), - Margin = new MarginPadding { Left = 5 }, - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - } - } - }, - } - }, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Margin = new MarginPadding { Right = 10 } } - } - } - } + }, + }, + }, }, }; From 33e91cf51227294bec0ccf74904ef18813aafd2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 31 Dec 2022 20:28:28 +0100 Subject: [PATCH 16/24] Implement cover toggling --- .../Header/Components/ToggleCoverButton.cs | 2 +- .../Profile/Header/TopHeaderContainer.cs | 31 ++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs b/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs index 9ae529f3ae..ef13f089c3 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { public partial class ToggleCoverButton : ProfileHeaderButton { - public readonly BindableBool CoverVisible = new BindableBool(); + public readonly BindableBool CoverVisible = new BindableBool(true); public override LocalisableString TooltipText => CoverVisible.Value ? UsersStrings.ShowCoverTo0 : UsersStrings.ShowCoverTo1; diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 0204800326..ce0c56b52b 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -23,7 +23,8 @@ namespace osu.Game.Overlays.Profile.Header { public partial class TopHeaderContainer : CompositeDrawable { - private const float avatar_size = 120; + private const float content_height = 65; + private const float vertical_padding = 10; public readonly Bindable User = new Bindable(); @@ -39,6 +40,7 @@ namespace osu.Game.Overlays.Profile.Header private UpdateableFlag userFlag = null!; private OsuSpriteText userCountryText = null!; private GroupBadgeFlow groupBadgeFlow = null!; + private ToggleCoverButton coverToggle = null!; [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) @@ -63,7 +65,6 @@ namespace osu.Game.Overlays.Profile.Header cover = new ProfileCoverBackground { RelativeSizeAxes = Axes.X, - Height = 250, }, new Container { @@ -77,10 +78,10 @@ namespace osu.Game.Overlays.Profile.Header Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN, - Vertical = 10 + Vertical = vertical_padding }, Spacing = new Vector2(20, 0), - Height = 85, + Height = content_height + 2 * vertical_padding, RelativeSizeAxes = Axes.X, Children = new Drawable[] { @@ -88,9 +89,7 @@ namespace osu.Game.Overlays.Profile.Header { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Size = new Vector2(avatar_size), Masking = true, - CornerRadius = avatar_size * 0.25f, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, @@ -172,7 +171,7 @@ namespace osu.Game.Overlays.Profile.Header }, } }, - new ToggleCoverButton + coverToggle = new ToggleCoverButton { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, @@ -183,8 +182,15 @@ namespace osu.Game.Overlays.Profile.Header }, }, }; + } - User.BindValueChanged(user => updateUser(user.NewValue)); + protected override void LoadComplete() + { + base.LoadComplete(); + + User.BindValueChanged(user => updateUser(user.NewValue), true); + coverToggle.CoverVisible.BindValueChanged(_ => updateCoverState(), true); + FinishTransforms(true); } private void updateUser(UserProfileData? data) @@ -203,6 +209,15 @@ namespace osu.Game.Overlays.Profile.Header groupBadgeFlow.User.Value = user; } + private void updateCoverState() + { + const float transition_duration = 250; + + cover.ResizeHeightTo(coverToggle.CoverVisible.Value ? 250 : 0, transition_duration, Easing.OutQuint); + avatar.ResizeTo(new Vector2(coverToggle.CoverVisible.Value ? 120 : content_height), transition_duration, Easing.OutQuint); + avatar.TransformTo(nameof(avatar.CornerRadius), coverToggle.CoverVisible.Value ? 40f : 20f, transition_duration, Easing.OutQuint); + } + private partial class ProfileCoverBackground : UserCoverBackground { protected override double LoadDelay => 0; From f2df36e6a556be58a73df652d778aea35b0e780b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 24 Jan 2023 23:30:07 +0100 Subject: [PATCH 17/24] Persist cover visibility to user settings Follows web precedent, wherein the setting is saved to local storage. --- .../Online/TestSceneUserProfileHeader.cs | 20 +++++++++++++++++++ osu.Game/Configuration/OsuConfigManager.cs | 3 +++ .../Header/Components/ToggleCoverButton.cs | 10 +++++----- .../Profile/Header/TopHeaderContainer.cs | 18 +++++++++++------ 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index 513c473830..640e895b6c 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -6,6 +6,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Testing; +using osu.Game.Configuration; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Profile; @@ -19,6 +20,9 @@ namespace osu.Game.Tests.Visual.Online [Cached] private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + [Resolved] + private OsuConfigManager configManager { get; set; } = null!; + private ProfileHeader header = null!; [SetUpSteps] @@ -33,6 +37,22 @@ namespace osu.Game.Tests.Visual.Online AddStep("Show example user", () => header.User.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo)); } + [Test] + public void TestProfileCoverExpanded() + { + AddStep("Set cover to expanded", () => configManager.SetValue(OsuSetting.ProfileCoverExpanded, true)); + AddStep("Show example user", () => header.User.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo)); + AddUntilStep("Cover is expanded", () => header.ChildrenOfType().Single().Height, () => Is.GreaterThan(0)); + } + + [Test] + public void TestProfileCoverCollapsed() + { + AddStep("Set cover to collapsed", () => configManager.SetValue(OsuSetting.ProfileCoverExpanded, false)); + AddStep("Show example user", () => header.User.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo)); + AddUntilStep("Cover is collapsed", () => header.ChildrenOfType().Single().Height, () => Is.EqualTo(0)); + } + [Test] public void TestOnlineState() { diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 6cbb677a64..507d5e611c 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -58,6 +58,8 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.BeatmapListingCardSize, BeatmapCardSize.Normal); + SetDefault(OsuSetting.ProfileCoverExpanded, true); + SetDefault(OsuSetting.ToolbarClockDisplayMode, ToolbarClockDisplayMode.Full); // Online settings @@ -375,5 +377,6 @@ namespace osu.Game.Configuration LastProcessedMetadataId, SafeAreaConsiderations, ComboColourNormalisationAmount, + ProfileCoverExpanded, } } diff --git a/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs b/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs index ef13f089c3..9171d5de7d 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ToggleCoverButton.cs @@ -16,9 +16,9 @@ namespace osu.Game.Overlays.Profile.Header.Components { public partial class ToggleCoverButton : ProfileHeaderButton { - public readonly BindableBool CoverVisible = new BindableBool(true); + public readonly BindableBool CoverExpanded = new BindableBool(true); - public override LocalisableString TooltipText => CoverVisible.Value ? UsersStrings.ShowCoverTo0 : UsersStrings.ShowCoverTo1; + public override LocalisableString TooltipText => CoverExpanded.Value ? UsersStrings.ShowCoverTo0 : UsersStrings.ShowCoverTo1; private SpriteIcon icon = null!; private Sample? sampleOpen; @@ -30,8 +30,8 @@ namespace osu.Game.Overlays.Profile.Header.Components { Action = () => { - CoverVisible.Toggle(); - (CoverVisible.Value ? sampleOpen : sampleClose)?.Play(); + CoverExpanded.Toggle(); + (CoverExpanded.Value ? sampleOpen : sampleClose)?.Play(); }; } @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.Profile.Header.Components Size = new Vector2(10.5f, 12) }; - CoverVisible.BindValueChanged(visible => updateState(visible.NewValue), true); + CoverExpanded.BindValueChanged(visible => updateState(visible.NewValue), true); } private void updateState(bool detailsVisible) => icon.Icon = detailsVisible ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown; diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index ce0c56b52b..389f2301c4 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Cursor; @@ -42,12 +43,16 @@ namespace osu.Game.Overlays.Profile.Header private GroupBadgeFlow groupBadgeFlow = null!; private ToggleCoverButton coverToggle = null!; + private Bindable coverExpanded = null!; + [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) + private void load(OverlayColourProvider colourProvider, OsuConfigManager configManager) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; + coverExpanded = configManager.GetBindable(OsuSetting.ProfileCoverExpanded); + InternalChildren = new Drawable[] { new Box @@ -175,7 +180,8 @@ namespace osu.Game.Overlays.Profile.Header { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Margin = new MarginPadding { Right = 10 } + Margin = new MarginPadding { Right = 10 }, + CoverExpanded = { BindTarget = coverExpanded } } }, }, @@ -189,7 +195,7 @@ namespace osu.Game.Overlays.Profile.Header base.LoadComplete(); User.BindValueChanged(user => updateUser(user.NewValue), true); - coverToggle.CoverVisible.BindValueChanged(_ => updateCoverState(), true); + coverExpanded.BindValueChanged(_ => updateCoverState(), true); FinishTransforms(true); } @@ -213,9 +219,9 @@ namespace osu.Game.Overlays.Profile.Header { const float transition_duration = 250; - cover.ResizeHeightTo(coverToggle.CoverVisible.Value ? 250 : 0, transition_duration, Easing.OutQuint); - avatar.ResizeTo(new Vector2(coverToggle.CoverVisible.Value ? 120 : content_height), transition_duration, Easing.OutQuint); - avatar.TransformTo(nameof(avatar.CornerRadius), coverToggle.CoverVisible.Value ? 40f : 20f, transition_duration, Easing.OutQuint); + cover.ResizeHeightTo(coverToggle.CoverExpanded.Value ? 250 : 0, transition_duration, Easing.OutQuint); + avatar.ResizeTo(new Vector2(coverToggle.CoverExpanded.Value ? 120 : content_height), transition_duration, Easing.OutQuint); + avatar.TransformTo(nameof(avatar.CornerRadius), coverToggle.CoverExpanded.Value ? 40f : 20f, transition_duration, Easing.OutQuint); } private partial class ProfileCoverBackground : UserCoverBackground From d8365f4fca4bfc0c52f261eaf79e67eafa7a8eb5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jan 2023 11:47:15 +0900 Subject: [PATCH 18/24] Reverse order of application to match `DrawableHitObject` --- osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs index a62efa96bf..23c18d9207 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonMainCirclePiece.cs @@ -122,10 +122,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon // Schedule the change to avoid transforms piling up. Scheduler.AddOnce(() => { - updateStateTransforms(drawableObject, drawableObject.State.Value); - ApplyTransformsAt(double.MinValue, true); ClearTransformsAfter(double.MinValue, true); + + updateStateTransforms(drawableObject, drawableObject.State.Value); }); }, true); From 3e91dd2a16094a84f6fdbeeadfbafe06a14999db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jan 2023 14:27:44 +0900 Subject: [PATCH 19/24] Update spacing along with expanded state --- .../Overlays/Profile/Header/TopHeaderContainer.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 389f2301c4..57197ab0de 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -45,6 +45,8 @@ namespace osu.Game.Overlays.Profile.Header private Bindable coverExpanded = null!; + private FillFlowContainer flow = null!; + [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuConfigManager configManager) { @@ -77,7 +79,7 @@ namespace osu.Game.Overlays.Profile.Header AutoSizeAxes = Axes.Y, Children = new Drawable[] { - new FillFlowContainer + flow = new FillFlowContainer { Direction = FillDirection.Horizontal, Padding = new MarginPadding @@ -85,7 +87,6 @@ namespace osu.Game.Overlays.Profile.Header Left = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = vertical_padding }, - Spacing = new Vector2(20, 0), Height = content_height + 2 * vertical_padding, RelativeSizeAxes = Axes.X, Children = new Drawable[] @@ -219,9 +220,12 @@ namespace osu.Game.Overlays.Profile.Header { const float transition_duration = 250; - cover.ResizeHeightTo(coverToggle.CoverExpanded.Value ? 250 : 0, transition_duration, Easing.OutQuint); - avatar.ResizeTo(new Vector2(coverToggle.CoverExpanded.Value ? 120 : content_height), transition_duration, Easing.OutQuint); - avatar.TransformTo(nameof(avatar.CornerRadius), coverToggle.CoverExpanded.Value ? 40f : 20f, transition_duration, Easing.OutQuint); + bool expanded = coverToggle.CoverExpanded.Value; + + cover.ResizeHeightTo(expanded ? 250 : 0, transition_duration, Easing.OutQuint); + avatar.ResizeTo(new Vector2(expanded ? 120 : content_height), transition_duration, Easing.OutQuint); + avatar.TransformTo(nameof(avatar.CornerRadius), expanded ? 40f : 20f, transition_duration, Easing.OutQuint); + flow.TransformTo(nameof(flow.Spacing), new Vector2(expanded ? 20f : 10f), transition_duration, Easing.OutQuint); } private partial class ProfileCoverBackground : UserCoverBackground From 6bf7773532c117791c67451bae8280b84f2748cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jan 2023 14:27:54 +0900 Subject: [PATCH 20/24] Increase duration of expansion transition --- osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 57197ab0de..652ebcec26 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -218,7 +218,7 @@ namespace osu.Game.Overlays.Profile.Header private void updateCoverState() { - const float transition_duration = 250; + const float transition_duration = 500; bool expanded = coverToggle.CoverExpanded.Value; From f81dea4166baf3bc7d0816d82df62c2efac8e075 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jan 2023 16:24:52 +0900 Subject: [PATCH 21/24] Remove now unused localisation string --- osu.Game/Localisation/UserInterfaceStrings.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index fb9eeeb3de..ea664d7b50 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -109,11 +109,6 @@ namespace osu.Game.Localisation /// public static LocalisableString ModSelectHotkeyStyle => new TranslatableString(getKey(@"mod_select_hotkey_style"), @"Mod select hotkey style"); - /// - /// "Background blur" - /// - public static LocalisableString BackgroundBlurLevel => new TranslatableString(getKey(@"background_blur_level"), @"Background blur"); - /// /// "no limit" /// From 1a9ed1ac3fa56473f5b2aaa586ba7f747de291ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jan 2023 16:28:06 +0900 Subject: [PATCH 22/24] Remove unnecessary `IgnoreUserSettings` value change --- osu.Game/Screens/Select/SongSelect.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 505f932bff..680c740b01 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -133,15 +133,11 @@ namespace osu.Game.Screens.Select configBackgroundBlur = config.GetBindable(OsuSetting.SongSelectBackgoundBlur); configBackgroundBlur.BindValueChanged(e => { - if (this.IsCurrentScreen()) - { - ApplyToBackground(background => - { - background.IgnoreUserSettings.Value = true; - background.BlurAmount.Value = e.NewValue ? BACKGROUND_BLUR : 0; - }); - } - }, true); + if (!this.IsCurrentScreen()) + return; + + ApplyToBackground(b => b.BlurAmount.Value = e.NewValue ? BACKGROUND_BLUR : 0); + }); LoadComponentAsync(Carousel = new BeatmapCarousel { From e333e12b2ec1e0d5985c57d6ad94b858627690fc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jan 2023 16:28:38 +0900 Subject: [PATCH 23/24] Fix typo in settings enum (seriously) --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- .../Settings/Sections/UserInterface/SongSelectSettings.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index fff5dc62c6..1c1745b55d 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -60,7 +60,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.ToolbarClockDisplayMode, ToolbarClockDisplayMode.Full); - SetDefault(OsuSetting.SongSelectBackgoundBlur, true); + SetDefault(OsuSetting.SongSelectBackgroundBlur, true); // Online settings SetDefault(OsuSetting.Username, string.Empty); @@ -341,7 +341,7 @@ namespace osu.Game.Configuration ChatDisplayHeight, BeatmapListingCardSize, ToolbarClockDisplayMode, - SongSelectBackgoundBlur, + SongSelectBackgroundBlur, Version, ShowFirstRunSetup, ShowConvertedBeatmaps, diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index d40d24a528..6f30fcd100 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface new SettingsCheckbox { LabelText = GameplaySettingsStrings.BackgroundBlur, - Current = config.GetBindable(OsuSetting.SongSelectBackgoundBlur) + Current = config.GetBindable(OsuSetting.SongSelectBackgroundBlur) } }; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 680c740b01..41e722ae88 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader(true)] private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config) { - configBackgroundBlur = config.GetBindable(OsuSetting.SongSelectBackgoundBlur); + configBackgroundBlur = config.GetBindable(OsuSetting.SongSelectBackgroundBlur); configBackgroundBlur.BindValueChanged(e => { if (!this.IsCurrentScreen()) From 01e280eb6bba20f85b49e98379550ad20906822c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jan 2023 16:31:41 +0900 Subject: [PATCH 24/24] Add classic default for song select blur setting --- .../Settings/Sections/UserInterface/SongSelectSettings.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 6f30fcd100..d3303e409c 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -46,7 +46,8 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface new SettingsCheckbox { LabelText = GameplaySettingsStrings.BackgroundBlur, - Current = config.GetBindable(OsuSetting.SongSelectBackgroundBlur) + Current = config.GetBindable(OsuSetting.SongSelectBackgroundBlur), + ClassicDefault = false, } }; }