From 4149235e63173f374a80a7235411ef72588c455b Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 5 Oct 2022 17:50:36 +0900 Subject: [PATCH 01/16] Limit minimum brightness of combo colours --- osu.Game/Configuration/OsuConfigManager.cs | 4 +- osu.Game/Graphics/OsuColour.cs | 167 ++++++++++++++++++ .../Sections/Gameplay/BeatmapSettings.cs | 6 + .../Objects/Drawables/DrawableHitObject.cs | 14 +- 4 files changed, 189 insertions(+), 2 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index e3bfb6b1e9..b433d81f31 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -175,6 +175,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f); SetDefault(OsuSetting.LastProcessedMetadataId, -1); + SetDefault(OsuSetting.ComboColourBrightness, 0.7f, 0f, 1f); } protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup) @@ -370,6 +371,7 @@ namespace osu.Game.Configuration DiscordRichPresence, AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, - LastProcessedMetadataId + LastProcessedMetadataId, + ComboColourBrightness } } diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 91161d5c71..bd0604bb76 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -229,6 +229,173 @@ namespace osu.Game.Graphics return Gray(brightness > 0.5f ? 0.2f : 0.9f); } + /// + /// Converts RGBA to HSPA. + /// + public static Color4 ToHSPA(Color4 colour) + { + const float p_r = 0.299f; + const float p_g = 0.587f; + const float p_b = 0.114f; + + Color4 result = new Color4 + { + A = colour.A, + B = MathF.Sqrt(colour.R * colour.R * p_r + colour.G * colour.G * p_g + colour.B + colour.B * p_b) + }; + + if (colour.R == colour.G && colour.R == colour.B) + return result; + + if (colour.R >= colour.G && colour.R >= colour.B) + { + if (colour.B >= colour.G) + { + result.R = 6f / 6f - 1f / 6f * (colour.B - colour.G) / (colour.R - colour.G); + result.G = 1f - colour.G / colour.R; + } + else + { + result.R = 0f / 6f + 1f / 6f * (colour.G - colour.B) / (colour.R - colour.B); + result.G = 1f - colour.B / colour.R; + } + } + else if (colour.G >= colour.R && colour.G >= colour.B) + { + if (colour.R >= colour.B) + { + result.R = 2f / 6f - 1f / 6f * (colour.R - colour.B) / (colour.G - colour.B); + result.G = 1f - colour.B / colour.G; + } + else + { + result.R = 2f / 6f + 1f / 6f * (colour.B - colour.R) / (colour.G - colour.R); + result.G = 1f - colour.R / colour.G; + } + } + else + { + if (colour.G >= colour.R) + { + result.R = 4f / 6f - 1f / 6f * (colour.G - colour.R) / (colour.B - colour.R); + result.G = 1f - colour.R / colour.B; + } + else + { + result.R = 4f / 6f + 1f / 6f * (colour.R - colour.G) / (colour.B - colour.G); + result.G = 1f - colour.G / colour.B; + } + } + + return result; + } + + public static Color4 FromHSPA(Color4 colour) + { + const float p_r = 0.299f; + const float p_g = 0.587f; + const float p_b = 0.114f; + + float minOverMax = 1f - colour.G; + + Color4 result = new Color4 { A = colour.A }; + + if (minOverMax > 0f) + { + float part = 1f + colour.R * (1f / minOverMax - 1f); + + if (colour.R < 1f / 6f) + { + colour.R = 6f * (colour.R - 0f / 6f); + result.B = colour.B / MathF.Sqrt(p_r / minOverMax / minOverMax + p_g * part * part + p_b); + result.R = result.B / minOverMax; + result.G = result.B + colour.R * (result.R - result.B); + } + else if (colour.R < 2f / 6f) + { + colour.R = 6f * (-colour.R + 2f / 6f); + result.B = colour.B / MathF.Sqrt(p_g / minOverMax / minOverMax + p_r * part * part + p_b); + result.G = result.B / minOverMax; + result.R = result.B + colour.R * (result.R - result.B); + } + else if (colour.R < 3f / 6f) + { + colour.R = 6f * (colour.R - 2f / 6f); + result.R = colour.B / MathF.Sqrt(p_g / minOverMax / minOverMax + p_b * part * part + p_r); + result.G = result.R / minOverMax; + result.B = result.R + colour.R * (result.G - result.R); + } + else if (colour.R < 4f / 6f) + { + colour.R = 6f * (-colour.R + 4f / 6f); + result.R = colour.B / MathF.Sqrt(p_b / minOverMax / minOverMax + p_g * part * part + p_r); + result.B = result.R / minOverMax; + result.G = result.R + colour.R * (result.B - result.R); + } + else if (colour.R < 5f / 6f) + { + colour.R = 6f * (colour.R - 4f / 6f); + result.G = colour.B / MathF.Sqrt(p_b / minOverMax / minOverMax + p_r * part * part + p_g); + result.B = result.G / minOverMax; + result.R = result.G + colour.R * (result.B - result.G); + } + else + { + colour.R = 6f * (-colour.R + 6f / 6f); + result.G = colour.B / MathF.Sqrt(p_r / minOverMax / minOverMax + p_b * part * part + p_g); + result.R = result.G / minOverMax; + result.B = result.G + colour.R * (result.R - result.G); + } + } + else + { + if (colour.R < 1f / 6f) + { + colour.R = 6f * (colour.R - 0f / 6f); + result.R = MathF.Sqrt(colour.B * colour.B / (p_r + p_g * colour.R * colour.R)); + result.G = result.R * colour.R; + result.B = 0f; + } + else if (colour.R < 2f / 6f) + { + colour.R = 6f * (-colour.R + 2f / 6f); + result.G = MathF.Sqrt(colour.B * colour.B / (p_g + p_r * colour.R * colour.R)); + result.R = result.G * colour.R; + result.B = 0f; + } + else if (colour.R < 3f / 6f) + { + colour.R = 6f * (colour.R - 2f / 6f); + result.G = MathF.Sqrt(colour.B * colour.B / (p_g + p_b * colour.R * colour.R)); + result.B = result.G * colour.R; + result.R = 0f; + } + else if (colour.R < 4f / 6f) + { + colour.R = 6f * (-colour.R + 4f / 6f); + result.B = MathF.Sqrt(colour.B * colour.B / (p_b + p_g * colour.R * colour.R)); + result.G = result.B * colour.R; + result.R = 0f; + } + else if (colour.R < 5f / 6f) + { + colour.R = 6f * (colour.R - 4f / 6f); + result.B = MathF.Sqrt(colour.B * colour.B / (p_b + p_r * colour.R * colour.R)); + result.R = result.B * colour.R; + result.G = 0f; + } + else + { + colour.R = 6f * (-colour.R + 6f / 6f); + result.R = MathF.Sqrt(colour.B * colour.B / (p_r + p_b * colour.R * colour.R)); + result.B = result.R * colour.R; + result.G = 0f; + } + } + + return result; + } + public readonly Color4 TeamColourRed = Color4Extensions.FromHex("#AA1414"); public readonly Color4 TeamColourBlue = Color4Extensions.FromHex("#1462AA"); diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs index becb7aa80f..16b7b74f38 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs @@ -40,6 +40,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay LabelText = GraphicsSettingsStrings.StoryboardVideo, Current = config.GetBindable(OsuSetting.ShowStoryboard) }, + new SettingsSlider + { + LabelText = "Combo colour brightness", + Current = config.GetBindable(OsuSetting.ComboColourBrightness), + DisplayAsPercentage = true + } }; } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index dec68a6c22..0ef15ed5c2 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Threading; using osu.Game.Audio; using osu.Game.Configuration; +using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Pooling; using osu.Game.Rulesets.Objects.Types; @@ -128,6 +129,7 @@ namespace osu.Game.Rulesets.Objects.Drawables private readonly Bindable comboIndexBindable = new Bindable(); private readonly Bindable positionalHitsoundsLevel = new Bindable(); + private readonly Bindable comboColourBrightness = new Bindable(); private readonly Bindable comboIndexWithOffsetsBindable = new Bindable(); protected override bool RequiresChildrenUpdate => true; @@ -171,6 +173,7 @@ namespace osu.Game.Rulesets.Objects.Drawables private void load(OsuConfigManager config, ISkinSource skinSource) { config.BindWith(OsuSetting.PositionalHitsoundsLevel, positionalHitsoundsLevel); + config.BindWith(OsuSetting.ComboColourBrightness, comboColourBrightness); // Explicit non-virtual function call in case a DrawableHitObject overrides AddInternal. base.AddInternal(Samples = new PausableSkinnableSound()); @@ -192,6 +195,8 @@ namespace osu.Game.Rulesets.Objects.Drawables comboIndexBindable.BindValueChanged(_ => UpdateComboColour()); comboIndexWithOffsetsBindable.BindValueChanged(_ => UpdateComboColour(), true); + comboColourBrightness.BindValueChanged(_ => UpdateComboColour()); + // Apply transforms updateState(State.Value, true); } @@ -519,7 +524,14 @@ namespace osu.Game.Rulesets.Objects.Drawables { if (!(HitObject is IHasComboInformation combo)) return; - AccentColour.Value = combo.GetComboColour(CurrentSkin); + Color4 colour = combo.GetComboColour(CurrentSkin); + + // Normalise the combo colour to the given brightness level. + colour = OsuColour.ToHSPA(colour); + colour.B = comboColourBrightness.Value; + colour = OsuColour.FromHSPA(colour); + + AccentColour.Value = colour; } /// From b43bae122c1ec719b074b7f2e1ac39cbda338541 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 14 Oct 2022 13:40:48 +0900 Subject: [PATCH 02/16] Fix incorrect porting of code --- osu.Game/Graphics/OsuColour.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index bd0604bb76..0f055856d3 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -302,11 +302,10 @@ namespace osu.Game.Graphics if (minOverMax > 0f) { - float part = 1f + colour.R * (1f / minOverMax - 1f); - if (colour.R < 1f / 6f) { colour.R = 6f * (colour.R - 0f / 6f); + float part = 1f + colour.R * (1f / minOverMax - 1f); result.B = colour.B / MathF.Sqrt(p_r / minOverMax / minOverMax + p_g * part * part + p_b); result.R = result.B / minOverMax; result.G = result.B + colour.R * (result.R - result.B); @@ -314,13 +313,15 @@ namespace osu.Game.Graphics else if (colour.R < 2f / 6f) { colour.R = 6f * (-colour.R + 2f / 6f); + float part = 1f + colour.R * (1f / minOverMax - 1f); result.B = colour.B / MathF.Sqrt(p_g / minOverMax / minOverMax + p_r * part * part + p_b); result.G = result.B / minOverMax; - result.R = result.B + colour.R * (result.R - result.B); + result.R = result.B + colour.R * (result.G - result.B); } else if (colour.R < 3f / 6f) { colour.R = 6f * (colour.R - 2f / 6f); + float part = 1f + colour.R * (1f / minOverMax - 1f); result.R = colour.B / MathF.Sqrt(p_g / minOverMax / minOverMax + p_b * part * part + p_r); result.G = result.R / minOverMax; result.B = result.R + colour.R * (result.G - result.R); @@ -328,6 +329,7 @@ namespace osu.Game.Graphics else if (colour.R < 4f / 6f) { colour.R = 6f * (-colour.R + 4f / 6f); + float part = 1f + colour.R * (1f / minOverMax - 1f); result.R = colour.B / MathF.Sqrt(p_b / minOverMax / minOverMax + p_g * part * part + p_r); result.B = result.R / minOverMax; result.G = result.R + colour.R * (result.B - result.R); @@ -335,6 +337,7 @@ namespace osu.Game.Graphics else if (colour.R < 5f / 6f) { colour.R = 6f * (colour.R - 4f / 6f); + float part = 1f + colour.R * (1f / minOverMax - 1f); result.G = colour.B / MathF.Sqrt(p_b / minOverMax / minOverMax + p_r * part * part + p_g); result.B = result.G / minOverMax; result.R = result.G + colour.R * (result.B - result.G); @@ -342,6 +345,7 @@ namespace osu.Game.Graphics else { colour.R = 6f * (-colour.R + 6f / 6f); + float part = 1f + colour.R * (1f / minOverMax - 1f); result.G = colour.B / MathF.Sqrt(p_r / minOverMax / minOverMax + p_b * part * part + p_g); result.R = result.G / minOverMax; result.B = result.G + colour.R * (result.R - result.G); From 15db65c037c22f672272733fb4b8e1d9a25f731b Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 14 Oct 2022 14:12:48 +0900 Subject: [PATCH 03/16] Extract to struct, add dictionary term --- osu.Game/Graphics/HSPAColour.cs | 200 ++++++++++++++++++ osu.Game/Graphics/OsuColour.cs | 171 --------------- .../Objects/Drawables/DrawableHitObject.cs | 4 +- osu.sln.DotSettings | 1 + 4 files changed, 202 insertions(+), 174 deletions(-) create mode 100644 osu.Game/Graphics/HSPAColour.cs diff --git a/osu.Game/Graphics/HSPAColour.cs b/osu.Game/Graphics/HSPAColour.cs new file mode 100644 index 0000000000..5e3bc29b7e --- /dev/null +++ b/osu.Game/Graphics/HSPAColour.cs @@ -0,0 +1,200 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osuTK.Graphics; + +namespace osu.Game.Graphics +{ + public struct HSPAColour + { + private const float p_r = 0.299f; + private const float p_g = 0.587f; + private const float p_b = 0.114f; + + /// + /// The hue. + /// + public float H; + + /// + /// The saturation. + /// + public float S; + + /// + /// The perceived brightness of this colour. + /// + public float P; + + /// + /// The alpha. + /// + public float A; + + public HSPAColour(float h, float s, float p, float a) + { + H = h; + S = s; + P = p; + A = a; + } + + public HSPAColour(Color4 colour) + { + H = 0; + S = 0; + P = MathF.Sqrt(colour.R * colour.R * p_r + colour.G * colour.G * p_g + colour.B + colour.B * p_b); + A = colour.A; + + if (colour.R == colour.G && colour.R == colour.B) + return; + + if (colour.R >= colour.G && colour.R >= colour.B) + { + if (colour.B >= colour.G) + { + H = 6f / 6f - 1f / 6f * (colour.B - colour.G) / (colour.R - colour.G); + S = 1f - colour.G / colour.R; + } + else + { + H = 0f / 6f + 1f / 6f * (colour.G - colour.B) / (colour.R - colour.B); + S = 1f - colour.B / colour.R; + } + } + else if (colour.G >= colour.R && colour.G >= colour.B) + { + if (colour.R >= colour.B) + { + H = 2f / 6f - 1f / 6f * (colour.R - colour.B) / (colour.G - colour.B); + S = 1f - colour.B / colour.G; + } + else + { + H = 2f / 6f + 1f / 6f * (colour.B - colour.R) / (colour.G - colour.R); + S = 1f - colour.R / colour.G; + } + } + else + { + if (colour.G >= colour.R) + { + H = 4f / 6f - 1f / 6f * (colour.G - colour.R) / (colour.B - colour.R); + S = 1f - colour.R / colour.B; + } + else + { + H = 4f / 6f + 1f / 6f * (colour.R - colour.G) / (colour.B - colour.G); + S = 1f - colour.G / colour.B; + } + } + } + + public Color4 ToColor4() + { + float minOverMax = 1f - S; + + Color4 result = new Color4 { A = A }; + + if (minOverMax > 0f) + { + if (H < 1f / 6f) + { + H = 6f * (H - 0f / 6f); + float part = 1f + H * (1f / minOverMax - 1f); + result.B = P / MathF.Sqrt(p_r / minOverMax / minOverMax + p_g * part * part + p_b); + result.R = result.B / minOverMax; + result.G = result.B + H * (result.R - result.B); + } + else if (H < 2f / 6f) + { + H = 6f * (-H + 2f / 6f); + float part = 1f + H * (1f / minOverMax - 1f); + result.B = P / MathF.Sqrt(p_g / minOverMax / minOverMax + p_r * part * part + p_b); + result.G = result.B / minOverMax; + result.R = result.B + H * (result.G - result.B); + } + else if (H < 3f / 6f) + { + H = 6f * (H - 2f / 6f); + float part = 1f + H * (1f / minOverMax - 1f); + result.R = P / MathF.Sqrt(p_g / minOverMax / minOverMax + p_b * part * part + p_r); + result.G = result.R / minOverMax; + result.B = result.R + H * (result.G - result.R); + } + else if (H < 4f / 6f) + { + H = 6f * (-H + 4f / 6f); + float part = 1f + H * (1f / minOverMax - 1f); + result.R = P / MathF.Sqrt(p_b / minOverMax / minOverMax + p_g * part * part + p_r); + result.B = result.R / minOverMax; + result.G = result.R + H * (result.B - result.R); + } + else if (H < 5f / 6f) + { + H = 6f * (H - 4f / 6f); + float part = 1f + H * (1f / minOverMax - 1f); + result.G = P / MathF.Sqrt(p_b / minOverMax / minOverMax + p_r * part * part + p_g); + result.B = result.G / minOverMax; + result.R = result.G + H * (result.B - result.G); + } + else + { + H = 6f * (-H + 6f / 6f); + float part = 1f + H * (1f / minOverMax - 1f); + result.G = P / MathF.Sqrt(p_r / minOverMax / minOverMax + p_b * part * part + p_g); + result.R = result.G / minOverMax; + result.B = result.G + H * (result.R - result.G); + } + } + else + { + if (H < 1f / 6f) + { + H = 6f * (H - 0f / 6f); + result.R = MathF.Sqrt(P * P / (p_r + p_g * H * H)); + result.G = result.R * H; + result.B = 0f; + } + else if (H < 2f / 6f) + { + H = 6f * (-H + 2f / 6f); + result.G = MathF.Sqrt(P * P / (p_g + p_r * H * H)); + result.R = result.G * H; + result.B = 0f; + } + else if (H < 3f / 6f) + { + H = 6f * (H - 2f / 6f); + result.G = MathF.Sqrt(P * P / (p_g + p_b * H * H)); + result.B = result.G * H; + result.R = 0f; + } + else if (H < 4f / 6f) + { + H = 6f * (-H + 4f / 6f); + result.B = MathF.Sqrt(P * P / (p_b + p_g * H * H)); + result.G = result.B * H; + result.R = 0f; + } + else if (H < 5f / 6f) + { + H = 6f * (H - 4f / 6f); + result.B = MathF.Sqrt(P * P / (p_b + p_r * H * H)); + result.R = result.B * H; + result.G = 0f; + } + else + { + H = 6f * (-H + 6f / 6f); + result.R = MathF.Sqrt(P * P / (p_r + p_b * H * H)); + result.B = result.R * H; + result.G = 0f; + } + } + + return result; + } + } +} diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 0f055856d3..91161d5c71 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -229,177 +229,6 @@ namespace osu.Game.Graphics return Gray(brightness > 0.5f ? 0.2f : 0.9f); } - /// - /// Converts RGBA to HSPA. - /// - public static Color4 ToHSPA(Color4 colour) - { - const float p_r = 0.299f; - const float p_g = 0.587f; - const float p_b = 0.114f; - - Color4 result = new Color4 - { - A = colour.A, - B = MathF.Sqrt(colour.R * colour.R * p_r + colour.G * colour.G * p_g + colour.B + colour.B * p_b) - }; - - if (colour.R == colour.G && colour.R == colour.B) - return result; - - if (colour.R >= colour.G && colour.R >= colour.B) - { - if (colour.B >= colour.G) - { - result.R = 6f / 6f - 1f / 6f * (colour.B - colour.G) / (colour.R - colour.G); - result.G = 1f - colour.G / colour.R; - } - else - { - result.R = 0f / 6f + 1f / 6f * (colour.G - colour.B) / (colour.R - colour.B); - result.G = 1f - colour.B / colour.R; - } - } - else if (colour.G >= colour.R && colour.G >= colour.B) - { - if (colour.R >= colour.B) - { - result.R = 2f / 6f - 1f / 6f * (colour.R - colour.B) / (colour.G - colour.B); - result.G = 1f - colour.B / colour.G; - } - else - { - result.R = 2f / 6f + 1f / 6f * (colour.B - colour.R) / (colour.G - colour.R); - result.G = 1f - colour.R / colour.G; - } - } - else - { - if (colour.G >= colour.R) - { - result.R = 4f / 6f - 1f / 6f * (colour.G - colour.R) / (colour.B - colour.R); - result.G = 1f - colour.R / colour.B; - } - else - { - result.R = 4f / 6f + 1f / 6f * (colour.R - colour.G) / (colour.B - colour.G); - result.G = 1f - colour.G / colour.B; - } - } - - return result; - } - - public static Color4 FromHSPA(Color4 colour) - { - const float p_r = 0.299f; - const float p_g = 0.587f; - const float p_b = 0.114f; - - float minOverMax = 1f - colour.G; - - Color4 result = new Color4 { A = colour.A }; - - if (minOverMax > 0f) - { - if (colour.R < 1f / 6f) - { - colour.R = 6f * (colour.R - 0f / 6f); - float part = 1f + colour.R * (1f / minOverMax - 1f); - result.B = colour.B / MathF.Sqrt(p_r / minOverMax / minOverMax + p_g * part * part + p_b); - result.R = result.B / minOverMax; - result.G = result.B + colour.R * (result.R - result.B); - } - else if (colour.R < 2f / 6f) - { - colour.R = 6f * (-colour.R + 2f / 6f); - float part = 1f + colour.R * (1f / minOverMax - 1f); - result.B = colour.B / MathF.Sqrt(p_g / minOverMax / minOverMax + p_r * part * part + p_b); - result.G = result.B / minOverMax; - result.R = result.B + colour.R * (result.G - result.B); - } - else if (colour.R < 3f / 6f) - { - colour.R = 6f * (colour.R - 2f / 6f); - float part = 1f + colour.R * (1f / minOverMax - 1f); - result.R = colour.B / MathF.Sqrt(p_g / minOverMax / minOverMax + p_b * part * part + p_r); - result.G = result.R / minOverMax; - result.B = result.R + colour.R * (result.G - result.R); - } - else if (colour.R < 4f / 6f) - { - colour.R = 6f * (-colour.R + 4f / 6f); - float part = 1f + colour.R * (1f / minOverMax - 1f); - result.R = colour.B / MathF.Sqrt(p_b / minOverMax / minOverMax + p_g * part * part + p_r); - result.B = result.R / minOverMax; - result.G = result.R + colour.R * (result.B - result.R); - } - else if (colour.R < 5f / 6f) - { - colour.R = 6f * (colour.R - 4f / 6f); - float part = 1f + colour.R * (1f / minOverMax - 1f); - result.G = colour.B / MathF.Sqrt(p_b / minOverMax / minOverMax + p_r * part * part + p_g); - result.B = result.G / minOverMax; - result.R = result.G + colour.R * (result.B - result.G); - } - else - { - colour.R = 6f * (-colour.R + 6f / 6f); - float part = 1f + colour.R * (1f / minOverMax - 1f); - result.G = colour.B / MathF.Sqrt(p_r / minOverMax / minOverMax + p_b * part * part + p_g); - result.R = result.G / minOverMax; - result.B = result.G + colour.R * (result.R - result.G); - } - } - else - { - if (colour.R < 1f / 6f) - { - colour.R = 6f * (colour.R - 0f / 6f); - result.R = MathF.Sqrt(colour.B * colour.B / (p_r + p_g * colour.R * colour.R)); - result.G = result.R * colour.R; - result.B = 0f; - } - else if (colour.R < 2f / 6f) - { - colour.R = 6f * (-colour.R + 2f / 6f); - result.G = MathF.Sqrt(colour.B * colour.B / (p_g + p_r * colour.R * colour.R)); - result.R = result.G * colour.R; - result.B = 0f; - } - else if (colour.R < 3f / 6f) - { - colour.R = 6f * (colour.R - 2f / 6f); - result.G = MathF.Sqrt(colour.B * colour.B / (p_g + p_b * colour.R * colour.R)); - result.B = result.G * colour.R; - result.R = 0f; - } - else if (colour.R < 4f / 6f) - { - colour.R = 6f * (-colour.R + 4f / 6f); - result.B = MathF.Sqrt(colour.B * colour.B / (p_b + p_g * colour.R * colour.R)); - result.G = result.B * colour.R; - result.R = 0f; - } - else if (colour.R < 5f / 6f) - { - colour.R = 6f * (colour.R - 4f / 6f); - result.B = MathF.Sqrt(colour.B * colour.B / (p_b + p_r * colour.R * colour.R)); - result.R = result.B * colour.R; - result.G = 0f; - } - else - { - colour.R = 6f * (-colour.R + 6f / 6f); - result.R = MathF.Sqrt(colour.B * colour.B / (p_r + p_b * colour.R * colour.R)); - result.B = result.R * colour.R; - result.G = 0f; - } - } - - return result; - } - public readonly Color4 TeamColourRed = Color4Extensions.FromHex("#AA1414"); public readonly Color4 TeamColourBlue = Color4Extensions.FromHex("#1462AA"); diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 0ef15ed5c2..4ba64687db 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -527,9 +527,7 @@ namespace osu.Game.Rulesets.Objects.Drawables Color4 colour = combo.GetComboColour(CurrentSkin); // Normalise the combo colour to the given brightness level. - colour = OsuColour.ToHSPA(colour); - colour.B = comboColourBrightness.Value; - colour = OsuColour.FromHSPA(colour); + colour = new HSPAColour(colour) { P = comboColourBrightness.Value }.ToColor4(); AccentColour.Value = colour; } diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 44df495929..154ad0fe8c 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -334,6 +334,7 @@ GL GLSL HID + HSPA HSV HTML HUD From 8a88339e787293a7b585acce105aaff236f2c565 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 14 Oct 2022 14:37:24 +0900 Subject: [PATCH 04/16] Allow combo colour normalisation to be disabled --- osu.Game/Configuration/OsuConfigManager.cs | 3 +++ .../Sections/Gameplay/BeatmapSettings.cs | 23 +++++++++++++++++-- .../Objects/Drawables/DrawableHitObject.cs | 6 ++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index b433d81f31..33e61372da 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -175,6 +175,8 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f); SetDefault(OsuSetting.LastProcessedMetadataId, -1); + + SetDefault(OsuSetting.NormaliseComboColourBrightness, false); SetDefault(OsuSetting.ComboColourBrightness, 0.7f, 0f, 1f); } @@ -372,6 +374,7 @@ namespace osu.Game.Configuration AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, LastProcessedMetadataId, + NormaliseComboColourBrightness, ComboColourBrightness } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs index 16b7b74f38..0de8f6509f 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs @@ -4,6 +4,7 @@ #nullable disable using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; @@ -15,9 +16,15 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { protected override LocalisableString Header => GameplaySettingsStrings.BeatmapHeader; + private readonly BindableFloat comboColourBrightness = new BindableFloat(); + private readonly BindableBool normaliseComboColourBrightness = new BindableBool(); + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { + config.BindWith(OsuSetting.ComboColourBrightness, comboColourBrightness); + config.BindWith(OsuSetting.NormaliseComboColourBrightness, normaliseComboColourBrightness); + Children = new Drawable[] { new SettingsCheckbox @@ -40,13 +47,25 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay LabelText = GraphicsSettingsStrings.StoryboardVideo, Current = config.GetBindable(OsuSetting.ShowStoryboard) }, + new SettingsCheckbox + { + LabelText = "Normalise combo colour brightness", + Current = normaliseComboColourBrightness + }, new SettingsSlider { LabelText = "Combo colour brightness", - Current = config.GetBindable(OsuSetting.ComboColourBrightness), - DisplayAsPercentage = true + Current = comboColourBrightness, + DisplayAsPercentage = true, } }; } + + protected override void LoadComplete() + { + base.LoadComplete(); + + normaliseComboColourBrightness.BindValueChanged(normalise => comboColourBrightness.Disabled = !normalise.NewValue, true); + } } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 4ba64687db..7e2f93dced 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -129,6 +129,7 @@ namespace osu.Game.Rulesets.Objects.Drawables private readonly Bindable comboIndexBindable = new Bindable(); private readonly Bindable positionalHitsoundsLevel = new Bindable(); + private readonly Bindable normaliseComboColourBrightness = new Bindable(); private readonly Bindable comboColourBrightness = new Bindable(); private readonly Bindable comboIndexWithOffsetsBindable = new Bindable(); @@ -173,6 +174,7 @@ namespace osu.Game.Rulesets.Objects.Drawables private void load(OsuConfigManager config, ISkinSource skinSource) { config.BindWith(OsuSetting.PositionalHitsoundsLevel, positionalHitsoundsLevel); + config.BindWith(OsuSetting.NormaliseComboColourBrightness, normaliseComboColourBrightness); config.BindWith(OsuSetting.ComboColourBrightness, comboColourBrightness); // Explicit non-virtual function call in case a DrawableHitObject overrides AddInternal. @@ -195,6 +197,7 @@ namespace osu.Game.Rulesets.Objects.Drawables comboIndexBindable.BindValueChanged(_ => UpdateComboColour()); comboIndexWithOffsetsBindable.BindValueChanged(_ => UpdateComboColour(), true); + normaliseComboColourBrightness.BindValueChanged(_ => UpdateComboColour()); comboColourBrightness.BindValueChanged(_ => UpdateComboColour()); // Apply transforms @@ -527,7 +530,8 @@ namespace osu.Game.Rulesets.Objects.Drawables Color4 colour = combo.GetComboColour(CurrentSkin); // Normalise the combo colour to the given brightness level. - colour = new HSPAColour(colour) { P = comboColourBrightness.Value }.ToColor4(); + if (normaliseComboColourBrightness.Value) + colour = new HSPAColour(colour) { P = comboColourBrightness.Value }.ToColor4(); AccentColour.Value = colour; } From 2f3c80f884abd31f0b801a8b2c3193d619adfa60 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Nov 2022 13:08:29 +0900 Subject: [PATCH 05/16] Remove toggle and change method of application to blend with original colour --- osu.Game/Configuration/OsuConfigManager.cs | 4 +--- .../Settings/Sections/Gameplay/BeatmapSettings.cs | 14 -------------- .../Objects/Drawables/DrawableHitObject.cs | 10 +++++++--- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 08724aab4b..0d56ab8962 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -175,8 +175,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.LastProcessedMetadataId, -1); - SetDefault(OsuSetting.NormaliseComboColourBrightness, false); - SetDefault(OsuSetting.ComboColourBrightness, 0.7f, 0f, 1f); + SetDefault(OsuSetting.ComboColourBrightness, 0f, -1f, 1f, 1f); } protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup) @@ -367,7 +366,6 @@ namespace osu.Game.Configuration AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, LastProcessedMetadataId, - NormaliseComboColourBrightness, SafeAreaConsiderations, ComboColourBrightness, } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs index 0de8f6509f..8bfa3e502c 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs @@ -17,13 +17,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay protected override LocalisableString Header => GameplaySettingsStrings.BeatmapHeader; private readonly BindableFloat comboColourBrightness = new BindableFloat(); - private readonly BindableBool normaliseComboColourBrightness = new BindableBool(); [BackgroundDependencyLoader] private void load(OsuConfigManager config) { config.BindWith(OsuSetting.ComboColourBrightness, comboColourBrightness); - config.BindWith(OsuSetting.NormaliseComboColourBrightness, normaliseComboColourBrightness); Children = new Drawable[] { @@ -47,11 +45,6 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay LabelText = GraphicsSettingsStrings.StoryboardVideo, Current = config.GetBindable(OsuSetting.ShowStoryboard) }, - new SettingsCheckbox - { - LabelText = "Normalise combo colour brightness", - Current = normaliseComboColourBrightness - }, new SettingsSlider { LabelText = "Combo colour brightness", @@ -60,12 +53,5 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay } }; } - - protected override void LoadComplete() - { - base.LoadComplete(); - - normaliseComboColourBrightness.BindValueChanged(normalise => comboColourBrightness.Disabled = !normalise.NewValue, true); - } } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 8a32c015a3..077606cb3a 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -15,6 +15,7 @@ using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Threading; +using osu.Framework.Utils; using osu.Game.Audio; using osu.Game.Configuration; using osu.Game.Graphics; @@ -174,7 +175,6 @@ namespace osu.Game.Rulesets.Objects.Drawables private void load(OsuConfigManager config, ISkinSource skinSource) { config.BindWith(OsuSetting.PositionalHitsoundsLevel, positionalHitsoundsLevel); - config.BindWith(OsuSetting.NormaliseComboColourBrightness, normaliseComboColourBrightness); config.BindWith(OsuSetting.ComboColourBrightness, comboColourBrightness); // Explicit non-virtual function call in case a DrawableHitObject overrides AddInternal. @@ -522,8 +522,12 @@ namespace osu.Game.Rulesets.Objects.Drawables Color4 colour = combo.GetComboColour(CurrentSkin); // Normalise the combo colour to the given brightness level. - if (normaliseComboColourBrightness.Value) - colour = new HSPAColour(colour) { P = comboColourBrightness.Value }.ToColor4(); + if (comboColourBrightness.Value != 0) + { + float pAdjust = 0.6f + 0.4f * comboColourBrightness.Value; + + colour = Interpolation.ValueAt(Math.Abs(comboColourBrightness.Value), colour, new HSPAColour(colour) { P = pAdjust }.ToColor4(), 0, 1, Easing.Out); + } AccentColour.Value = colour; } From 99ba7c29dd99c92bd29396e276558206bc62076b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Nov 2022 13:46:50 +0900 Subject: [PATCH 06/16] Change range to 0-100% and rename to "normalisation" --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- .../Settings/Sections/Gameplay/BeatmapSettings.cs | 8 ++++---- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 6 ++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 0d56ab8962..98776c7487 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -175,7 +175,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.LastProcessedMetadataId, -1); - SetDefault(OsuSetting.ComboColourBrightness, 0f, -1f, 1f, 1f); + SetDefault(OsuSetting.ComboColourNormalisation, 0.2f, 0f, 1f, 0.01f); } protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup) @@ -367,6 +367,6 @@ namespace osu.Game.Configuration ShowOnlineExplicitContent, LastProcessedMetadataId, SafeAreaConsiderations, - ComboColourBrightness, + ComboColourNormalisation, } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs index 8bfa3e502c..ab9be70a5b 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs @@ -16,12 +16,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { protected override LocalisableString Header => GameplaySettingsStrings.BeatmapHeader; - private readonly BindableFloat comboColourBrightness = new BindableFloat(); + private readonly BindableFloat comboColourNormalisation = new BindableFloat(); [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - config.BindWith(OsuSetting.ComboColourBrightness, comboColourBrightness); + config.BindWith(OsuSetting.ComboColourNormalisation, comboColourNormalisation); Children = new Drawable[] { @@ -47,8 +47,8 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay }, new SettingsSlider { - LabelText = "Combo colour brightness", - Current = comboColourBrightness, + LabelText = "Combo colour normalisation", + Current = comboColourNormalisation, DisplayAsPercentage = true, } }; diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 077606cb3a..98fd73c8e9 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -175,7 +175,7 @@ namespace osu.Game.Rulesets.Objects.Drawables private void load(OsuConfigManager config, ISkinSource skinSource) { config.BindWith(OsuSetting.PositionalHitsoundsLevel, positionalHitsoundsLevel); - config.BindWith(OsuSetting.ComboColourBrightness, comboColourBrightness); + config.BindWith(OsuSetting.ComboColourNormalisation, comboColourBrightness); // Explicit non-virtual function call in case a DrawableHitObject overrides AddInternal. base.AddInternal(Samples = new PausableSkinnableSound()); @@ -524,9 +524,7 @@ namespace osu.Game.Rulesets.Objects.Drawables // Normalise the combo colour to the given brightness level. if (comboColourBrightness.Value != 0) { - float pAdjust = 0.6f + 0.4f * comboColourBrightness.Value; - - colour = Interpolation.ValueAt(Math.Abs(comboColourBrightness.Value), colour, new HSPAColour(colour) { P = pAdjust }.ToColor4(), 0, 1, Easing.Out); + colour = Interpolation.ValueAt(Math.Abs(comboColourBrightness.Value), colour, new HSPAColour(colour) { P = 0.6f }.ToColor4(), 0, 1); } AccentColour.Value = colour; From d8aa06ea92fa5a73c23b9305838efbd486aaaa55 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Nov 2022 13:55:01 +0900 Subject: [PATCH 07/16] Standardise "Visual Settings" components to fix mismatched paddings and labels --- .../Play/PlayerSettings/PlayerCheckbox.cs | 21 ++++++++++++------- .../Play/PlayerSettings/VisualSettings.cs | 16 ++------------ 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs index dc09676254..cea03d2155 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs @@ -1,22 +1,27 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings; namespace osu.Game.Screens.Play.PlayerSettings { - public class PlayerCheckbox : OsuCheckbox + public class PlayerCheckbox : SettingsCheckbox { - [BackgroundDependencyLoader] - private void load(OsuColour colours) + protected override Drawable CreateControl() => new PlayerCheckboxControl(); + + public class PlayerCheckboxControl : OsuCheckbox { - Nub.AccentColour = colours.Yellow; - Nub.GlowingAccentColour = colours.YellowLighter; - Nub.GlowColour = colours.YellowDark; + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Nub.AccentColour = colours.Yellow; + Nub.GlowingAccentColour = colours.YellowLighter; + Nub.GlowColour = colours.YellowDark; + } } } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index e55af0bba7..72a57f658c 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; @@ -24,26 +22,16 @@ namespace osu.Game.Screens.Play.PlayerSettings { Children = new Drawable[] { - new OsuSpriteText - { - Text = GameplaySettingsStrings.BackgroundDim - }, dimSliderBar = new PlayerSliderBar { + LabelText = GameplaySettingsStrings.BackgroundDim, DisplayAsPercentage = true }, - new OsuSpriteText - { - Text = GameplaySettingsStrings.BackgroundBlur - }, blurSliderBar = new PlayerSliderBar { + LabelText = GameplaySettingsStrings.BackgroundBlur, DisplayAsPercentage = true }, - new OsuSpriteText - { - Text = "Toggles:" - }, showStoryboardToggle = new PlayerCheckbox { LabelText = GraphicsSettingsStrings.StoryboardVideo }, beatmapSkinsToggle = new PlayerCheckbox { LabelText = SkinSettingsStrings.BeatmapSkins }, beatmapColorsToggle = new PlayerCheckbox { LabelText = SkinSettingsStrings.BeatmapColours }, From 61fc3c8cc0878dab7cea7a4dbc7d0bb26e6e6fab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Nov 2022 13:48:03 +0900 Subject: [PATCH 08/16] Add setting to visual settings toolbox --- osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 72a57f658c..10d132fc4d 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; -using osu.Game.Graphics.Sprites; using osu.Game.Localisation; namespace osu.Game.Screens.Play.PlayerSettings @@ -13,6 +12,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { private readonly PlayerSliderBar dimSliderBar; private readonly PlayerSliderBar blurSliderBar; + private readonly PlayerSliderBar comboColourNormalisationSliderBar; private readonly PlayerCheckbox showStoryboardToggle; private readonly PlayerCheckbox beatmapSkinsToggle; private readonly PlayerCheckbox beatmapColorsToggle; @@ -35,6 +35,11 @@ namespace osu.Game.Screens.Play.PlayerSettings showStoryboardToggle = new PlayerCheckbox { LabelText = GraphicsSettingsStrings.StoryboardVideo }, beatmapSkinsToggle = new PlayerCheckbox { LabelText = SkinSettingsStrings.BeatmapSkins }, beatmapColorsToggle = new PlayerCheckbox { LabelText = SkinSettingsStrings.BeatmapColours }, + comboColourNormalisationSliderBar = new PlayerSliderBar + { + LabelText = "Combo colour normalisation", + DisplayAsPercentage = true, + }, }; } @@ -46,6 +51,7 @@ namespace osu.Game.Screens.Play.PlayerSettings showStoryboardToggle.Current = config.GetBindable(OsuSetting.ShowStoryboard); beatmapSkinsToggle.Current = config.GetBindable(OsuSetting.BeatmapSkins); beatmapColorsToggle.Current = config.GetBindable(OsuSetting.BeatmapColours); + comboColourNormalisationSliderBar.Current = config.GetBindable(OsuSetting.ComboColourNormalisation); } } } From 50b6fe4acb24e5fa9794d9653489c84d78989d12 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Nov 2022 14:01:03 +0900 Subject: [PATCH 09/16] Localise new label --- osu.Game/Localisation/GraphicsSettingsStrings.cs | 5 +++++ .../Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs | 2 +- osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Localisation/GraphicsSettingsStrings.cs b/osu.Game/Localisation/GraphicsSettingsStrings.cs index 2ab9d9de87..6e05929d81 100644 --- a/osu.Game/Localisation/GraphicsSettingsStrings.cs +++ b/osu.Game/Localisation/GraphicsSettingsStrings.cs @@ -99,6 +99,11 @@ namespace osu.Game.Localisation /// public static LocalisableString StoryboardVideo => new TranslatableString(getKey(@"storyboard_video"), @"Storyboard / video"); + /// + /// "Combo colour normalisation" + /// + public static LocalisableString ComboColourNormalisation => new TranslatableString(getKey(@"combo_colour_normalisation"), @"Combo colour normalisation"); + /// /// "Hit lighting" /// diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs index ab9be70a5b..8d64337eab 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay }, new SettingsSlider { - LabelText = "Combo colour normalisation", + LabelText = GraphicsSettingsStrings.ComboColourNormalisation, Current = comboColourNormalisation, DisplayAsPercentage = true, } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 10d132fc4d..c837f61a09 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Play.PlayerSettings beatmapColorsToggle = new PlayerCheckbox { LabelText = SkinSettingsStrings.BeatmapColours }, comboColourNormalisationSliderBar = new PlayerSliderBar { - LabelText = "Combo colour normalisation", + LabelText = GraphicsSettingsStrings.ComboColourNormalisation, DisplayAsPercentage = true, }, }; From 3ec9686e5858ad02070e3358eb971e62c449987b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 2 Nov 2022 18:14:20 +0900 Subject: [PATCH 10/16] Fix test failures and rename configuration value to match better --- .../TestSceneLegacyBeatmapSkin.cs | 2 ++ .../Gameplay/TestSceneHitObjectAccentColour.cs | 14 +++++++++++++- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- .../Settings/Sections/Gameplay/BeatmapSettings.cs | 2 +- .../Objects/Drawables/DrawableHitObject.cs | 2 +- .../Screens/Play/PlayerSettings/VisualSettings.cs | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs index 1767d25e77..bb28b2b217 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs @@ -31,6 +31,8 @@ namespace osu.Game.Rulesets.Osu.Tests { config.BindWith(OsuSetting.BeatmapSkins, BeatmapSkins); config.BindWith(OsuSetting.BeatmapColours, BeatmapColours); + + config.SetValue(OsuSetting.ComboColourNormalisationAmount, 0f); } [TestCase(true, true)] diff --git a/osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs b/osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs index 9701a32951..bc4c1d4cf2 100644 --- a/osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs +++ b/osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -13,6 +14,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Textures; using osu.Framework.Testing; using osu.Game.Audio; +using osu.Game.Configuration; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Legacy; using osu.Game.Rulesets.Objects.Types; @@ -25,10 +27,20 @@ namespace osu.Game.Tests.Gameplay [HeadlessTest] public class TestSceneHitObjectAccentColour : OsuTestScene { + [Resolved] + private OsuConfigManager config { get; set; } + private Container skinContainer; [SetUp] - public void Setup() => Schedule(() => Child = skinContainer = new SkinProvidingContainer(new TestSkin())); + public void Setup() + { + Schedule(() => + { + config.SetValue(OsuSetting.ComboColourNormalisationAmount, 0f); + Child = skinContainer = new SkinProvidingContainer(new TestSkin()); + }); + } [Test] public void TestChangeComboIndexBeforeLoad() diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 98776c7487..fdaad8cf70 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -175,7 +175,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.LastProcessedMetadataId, -1); - SetDefault(OsuSetting.ComboColourNormalisation, 0.2f, 0f, 1f, 0.01f); + SetDefault(OsuSetting.ComboColourNormalisationAmount, 0.2f, 0f, 1f, 0.01f); } protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup) @@ -367,6 +367,6 @@ namespace osu.Game.Configuration ShowOnlineExplicitContent, LastProcessedMetadataId, SafeAreaConsiderations, - ComboColourNormalisation, + ComboColourNormalisationAmount, } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs index 8d64337eab..14ff6ac2b5 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - config.BindWith(OsuSetting.ComboColourNormalisation, comboColourNormalisation); + config.BindWith(OsuSetting.ComboColourNormalisationAmount, comboColourNormalisation); Children = new Drawable[] { diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 98fd73c8e9..f82a24ff01 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -175,7 +175,7 @@ namespace osu.Game.Rulesets.Objects.Drawables private void load(OsuConfigManager config, ISkinSource skinSource) { config.BindWith(OsuSetting.PositionalHitsoundsLevel, positionalHitsoundsLevel); - config.BindWith(OsuSetting.ComboColourNormalisation, comboColourBrightness); + config.BindWith(OsuSetting.ComboColourNormalisationAmount, comboColourBrightness); // Explicit non-virtual function call in case a DrawableHitObject overrides AddInternal. base.AddInternal(Samples = new PausableSkinnableSound()); diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index c837f61a09..6a7eabc6a2 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play.PlayerSettings showStoryboardToggle.Current = config.GetBindable(OsuSetting.ShowStoryboard); beatmapSkinsToggle.Current = config.GetBindable(OsuSetting.BeatmapSkins); beatmapColorsToggle.Current = config.GetBindable(OsuSetting.BeatmapColours); - comboColourNormalisationSliderBar.Current = config.GetBindable(OsuSetting.ComboColourNormalisation); + comboColourNormalisationSliderBar.Current = config.GetBindable(OsuSetting.ComboColourNormalisationAmount); } } } From 51078bddf95177e266ce101d9ddccbcebdb5a533 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 6 Nov 2022 23:34:04 +0900 Subject: [PATCH 11/16] Remove unused bindable --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index f82a24ff01..15d3e63be1 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -130,7 +130,6 @@ namespace osu.Game.Rulesets.Objects.Drawables private readonly Bindable comboIndexBindable = new Bindable(); private readonly Bindable positionalHitsoundsLevel = new Bindable(); - private readonly Bindable normaliseComboColourBrightness = new Bindable(); private readonly Bindable comboColourBrightness = new Bindable(); private readonly Bindable comboIndexWithOffsetsBindable = new Bindable(); @@ -197,7 +196,6 @@ namespace osu.Game.Rulesets.Objects.Drawables comboIndexBindable.BindValueChanged(_ => UpdateComboColour()); comboIndexWithOffsetsBindable.BindValueChanged(_ => UpdateComboColour(), true); - normaliseComboColourBrightness.BindValueChanged(_ => UpdateComboColour()); comboColourBrightness.BindValueChanged(_ => UpdateComboColour()); // Apply transforms From 75bf023f1445c4a67efc3ca66b8f783a0352f0ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 6 Nov 2022 23:35:51 +0900 Subject: [PATCH 12/16] Fix `HSPAColour.ToColour` not being pure --- osu.Game/Graphics/HSPAColour.cs | 93 +++++++++++++++++---------------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/osu.Game/Graphics/HSPAColour.cs b/osu.Game/Graphics/HSPAColour.cs index 5e3bc29b7e..18f4c6bca4 100644 --- a/osu.Game/Graphics/HSPAColour.cs +++ b/osu.Game/Graphics/HSPAColour.cs @@ -96,100 +96,101 @@ namespace osu.Game.Graphics float minOverMax = 1f - S; Color4 result = new Color4 { A = A }; + float h = H; if (minOverMax > 0f) { - if (H < 1f / 6f) + if (h < 1f / 6f) { - H = 6f * (H - 0f / 6f); - float part = 1f + H * (1f / minOverMax - 1f); + h = 6f * (h - 0f / 6f); + float part = 1f + h * (1f / minOverMax - 1f); result.B = P / MathF.Sqrt(p_r / minOverMax / minOverMax + p_g * part * part + p_b); result.R = result.B / minOverMax; - result.G = result.B + H * (result.R - result.B); + result.G = result.B + h * (result.R - result.B); } - else if (H < 2f / 6f) + else if (h < 2f / 6f) { - H = 6f * (-H + 2f / 6f); - float part = 1f + H * (1f / minOverMax - 1f); + h = 6f * (-h + 2f / 6f); + float part = 1f + h * (1f / minOverMax - 1f); result.B = P / MathF.Sqrt(p_g / minOverMax / minOverMax + p_r * part * part + p_b); result.G = result.B / minOverMax; - result.R = result.B + H * (result.G - result.B); + result.R = result.B + h * (result.G - result.B); } - else if (H < 3f / 6f) + else if (h < 3f / 6f) { - H = 6f * (H - 2f / 6f); - float part = 1f + H * (1f / minOverMax - 1f); + h = 6f * (h - 2f / 6f); + float part = 1f + h * (1f / minOverMax - 1f); result.R = P / MathF.Sqrt(p_g / minOverMax / minOverMax + p_b * part * part + p_r); result.G = result.R / minOverMax; - result.B = result.R + H * (result.G - result.R); + result.B = result.R + h * (result.G - result.R); } - else if (H < 4f / 6f) + else if (h < 4f / 6f) { - H = 6f * (-H + 4f / 6f); - float part = 1f + H * (1f / minOverMax - 1f); + h = 6f * (-h + 4f / 6f); + float part = 1f + h * (1f / minOverMax - 1f); result.R = P / MathF.Sqrt(p_b / minOverMax / minOverMax + p_g * part * part + p_r); result.B = result.R / minOverMax; - result.G = result.R + H * (result.B - result.R); + result.G = result.R + h * (result.B - result.R); } - else if (H < 5f / 6f) + else if (h < 5f / 6f) { - H = 6f * (H - 4f / 6f); - float part = 1f + H * (1f / minOverMax - 1f); + h = 6f * (h - 4f / 6f); + float part = 1f + h * (1f / minOverMax - 1f); result.G = P / MathF.Sqrt(p_b / minOverMax / minOverMax + p_r * part * part + p_g); result.B = result.G / minOverMax; - result.R = result.G + H * (result.B - result.G); + result.R = result.G + h * (result.B - result.G); } else { - H = 6f * (-H + 6f / 6f); - float part = 1f + H * (1f / minOverMax - 1f); + h = 6f * (-h + 6f / 6f); + float part = 1f + h * (1f / minOverMax - 1f); result.G = P / MathF.Sqrt(p_r / minOverMax / minOverMax + p_b * part * part + p_g); result.R = result.G / minOverMax; - result.B = result.G + H * (result.R - result.G); + result.B = result.G + h * (result.R - result.G); } } else { - if (H < 1f / 6f) + if (h < 1f / 6f) { - H = 6f * (H - 0f / 6f); - result.R = MathF.Sqrt(P * P / (p_r + p_g * H * H)); - result.G = result.R * H; + h = 6f * (h - 0f / 6f); + result.R = MathF.Sqrt(P * P / (p_r + p_g * h * h)); + result.G = result.R * h; result.B = 0f; } - else if (H < 2f / 6f) + else if (h < 2f / 6f) { - H = 6f * (-H + 2f / 6f); - result.G = MathF.Sqrt(P * P / (p_g + p_r * H * H)); - result.R = result.G * H; + h = 6f * (-h + 2f / 6f); + result.G = MathF.Sqrt(P * P / (p_g + p_r * h * h)); + result.R = result.G * h; result.B = 0f; } - else if (H < 3f / 6f) + else if (h < 3f / 6f) { - H = 6f * (H - 2f / 6f); - result.G = MathF.Sqrt(P * P / (p_g + p_b * H * H)); - result.B = result.G * H; + h = 6f * (h - 2f / 6f); + result.G = MathF.Sqrt(P * P / (p_g + p_b * h * h)); + result.B = result.G * h; result.R = 0f; } - else if (H < 4f / 6f) + else if (h < 4f / 6f) { - H = 6f * (-H + 4f / 6f); - result.B = MathF.Sqrt(P * P / (p_b + p_g * H * H)); - result.G = result.B * H; + h = 6f * (-h + 4f / 6f); + result.B = MathF.Sqrt(P * P / (p_b + p_g * h * h)); + result.G = result.B * h; result.R = 0f; } - else if (H < 5f / 6f) + else if (h < 5f / 6f) { - H = 6f * (H - 4f / 6f); - result.B = MathF.Sqrt(P * P / (p_b + p_r * H * H)); - result.R = result.B * H; + h = 6f * (h - 4f / 6f); + result.B = MathF.Sqrt(P * P / (p_b + p_r * h * h)); + result.R = result.B * h; result.G = 0f; } else { - H = 6f * (-H + 6f / 6f); - result.R = MathF.Sqrt(P * P / (p_r + p_b * H * H)); - result.B = result.R * H; + h = 6f * (-h + 6f / 6f); + result.R = MathF.Sqrt(P * P / (p_r + p_b * h * h)); + result.B = result.R * h; result.G = 0f; } } From dd4cd3cf8e5be9f5c413efa67be780a2a931e08c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Nov 2022 18:24:57 +0900 Subject: [PATCH 13/16] Move gameplay configuration to interface to allow editor overriding --- osu.Game/Configuration/IGameplaySettings.cs | 23 +++++++++++++++++++ osu.Game/Configuration/OsuConfigManager.cs | 6 ++++- osu.Game/OsuGameBase.cs | 1 + .../Objects/Drawables/DrawableHitObject.cs | 10 ++++---- 4 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Configuration/IGameplaySettings.cs diff --git a/osu.Game/Configuration/IGameplaySettings.cs b/osu.Game/Configuration/IGameplaySettings.cs new file mode 100644 index 0000000000..a35bdd20d0 --- /dev/null +++ b/osu.Game/Configuration/IGameplaySettings.cs @@ -0,0 +1,23 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; + +namespace osu.Game.Configuration +{ + /// + /// A settings provider which generally sources from (global user settings) + /// but can allow overriding settings by caching more locally. For instance, in the editor. + /// + /// + /// More settings can be moved into this interface as required. + /// + [Cached] + public interface IGameplaySettings + { + IBindable ComboColourNormalisationAmount { get; } + + IBindable PositionalHitsoundsLevel { get; } + } +} diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index fdaad8cf70..1286a07eeb 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -6,6 +6,7 @@ using System; using System.Diagnostics; using System.Globalization; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; using osu.Framework.Extensions; @@ -27,7 +28,7 @@ using osu.Game.Skinning; namespace osu.Game.Configuration { [ExcludeFromDynamicCompile] - public class OsuConfigManager : IniConfigManager + public class OsuConfigManager : IniConfigManager, IGameplaySettings { public OsuConfigManager(Storage storage) : base(storage) @@ -276,6 +277,9 @@ namespace osu.Game.Configuration public Func LookupSkinName { private get; set; } = _ => @"unknown"; public Func LookupKeyBindings { get; set; } = _ => @"unknown"; + + IBindable IGameplaySettings.ComboColourNormalisationAmount => GetOriginalBindable(OsuSetting.ComboColourNormalisationAmount); + IBindable IGameplaySettings.PositionalHitsoundsLevel => GetOriginalBindable(OsuSetting.PositionalHitsoundsLevel); } // IMPORTANT: These are used in user configuration files. diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 511f492b8a..1d5f5a75e5 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -262,6 +262,7 @@ namespace osu.Game dependencies.Cache(largeStore); dependencies.CacheAs(LocalConfig); + dependencies.CacheAs(LocalConfig); InitialiseFonts(); diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 15d3e63be1..6795a07cb4 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -129,8 +129,8 @@ namespace osu.Game.Rulesets.Objects.Drawables private readonly BindableList samplesBindable = new BindableList(); private readonly Bindable comboIndexBindable = new Bindable(); - private readonly Bindable positionalHitsoundsLevel = new Bindable(); - private readonly Bindable comboColourBrightness = new Bindable(); + private readonly IBindable positionalHitsoundsLevel = new Bindable(); + private readonly IBindable comboColourBrightness = new Bindable(); private readonly Bindable comboIndexWithOffsetsBindable = new Bindable(); protected override bool RequiresChildrenUpdate => true; @@ -171,10 +171,10 @@ namespace osu.Game.Rulesets.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, ISkinSource skinSource) + private void load(IGameplaySettings gameplaySettings, ISkinSource skinSource) { - config.BindWith(OsuSetting.PositionalHitsoundsLevel, positionalHitsoundsLevel); - config.BindWith(OsuSetting.ComboColourNormalisationAmount, comboColourBrightness); + positionalHitsoundsLevel.BindTo(gameplaySettings.PositionalHitsoundsLevel); + comboColourBrightness.BindTo(gameplaySettings.ComboColourNormalisationAmount); // Explicit non-virtual function call in case a DrawableHitObject overrides AddInternal. base.AddInternal(Samples = new PausableSkinnableSound()); From 4448fcb3c876241428f2015f51f35a735fe21740 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Nov 2022 18:28:48 +0900 Subject: [PATCH 14/16] Override combo colour brightness normalisation setting only in editor --- osu.Game/Screens/Edit/Editor.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 912681e114..65d2371551 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -59,7 +59,8 @@ namespace osu.Game.Screens.Edit { [Cached(typeof(IBeatSnapProvider))] [Cached] - public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler, IKeyBindingHandler, IBeatSnapProvider, ISamplePlaybackDisabler, IBeatSyncProvider + public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler, IKeyBindingHandler, IBeatSnapProvider, ISamplePlaybackDisabler, IBeatSyncProvider, + IGameplaySettings { public override float BackgroundParallaxAmount => 0.1f; @@ -99,6 +100,9 @@ namespace osu.Game.Screens.Edit [Resolved(canBeNull: true)] private INotificationOverlay notifications { get; set; } + [Resolved] + private IGameplaySettings globalGameplaySettings { get; set; } + public readonly Bindable Mode = new Bindable(); public IBindable SamplePlaybackDisabled => samplePlaybackDisabled; @@ -1031,5 +1035,11 @@ namespace osu.Game.Screens.Edit { } } + + // Combo colour normalisation should not be applied in the editor. + IBindable IGameplaySettings.ComboColourNormalisationAmount => new Bindable(); + + // Arguable. + IBindable IGameplaySettings.PositionalHitsoundsLevel => globalGameplaySettings.PositionalHitsoundsLevel; } } From 0af4bdaf5c3d0acc1b532770adb7a122c303ca48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 Nov 2022 18:29:15 +0900 Subject: [PATCH 15/16] Add back removed configuration elements --- osu.Game/Configuration/OsuConfigManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 1286a07eeb..3cabd6a21b 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -172,7 +172,9 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full); - SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f); + SetDefault(OsuSetting.EditorDim, 0.25f, 0f, 0.75f, 0.25f); + SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f, 0f, 1f, 0.25f); + SetDefault(OsuSetting.EditorShowHitMarkers, true); SetDefault(OsuSetting.LastProcessedMetadataId, -1); @@ -294,6 +296,7 @@ namespace osu.Game.Configuration GameplayCursorDuringTouch, DimLevel, BlurLevel, + EditorDim, LightenDuringBreaks, ShowStoryboard, KeyOverlay, @@ -366,6 +369,7 @@ namespace osu.Game.Configuration GameplayDisableWinKey, SeasonalBackgroundMode, EditorWaveformOpacity, + EditorShowHitMarkers, DiscordRichPresence, AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, From 151dd7c62f8c516a11f416883630c9e057785160 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 Nov 2022 22:10:27 +0900 Subject: [PATCH 16/16] Fix one more reverted change --- osu.Game/Configuration/OsuConfigManager.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 3cabd6a21b..6cbb677a64 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -5,7 +5,6 @@ using System; using System.Diagnostics; -using System.Globalization; using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; @@ -116,7 +115,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.MenuParallax, true); // See https://stackoverflow.com/a/63307411 for default sourcing. - SetDefault(OsuSetting.Prefer24HourTime, CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains(@"tt")); + SetDefault(OsuSetting.Prefer24HourTime, !CultureInfoHelper.SystemCulture.DateTimeFormat.ShortTimePattern.Contains(@"tt")); // Gameplay SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.2f, 0, 1);