1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Allow combo colour normalisation to be disabled

This commit is contained in:
Dan Balasescu 2022-10-14 14:37:24 +09:00
parent 15db65c037
commit 8a88339e78
3 changed files with 29 additions and 3 deletions

View File

@ -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
}
}

View File

@ -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<bool>(OsuSetting.ShowStoryboard)
},
new SettingsCheckbox
{
LabelText = "Normalise combo colour brightness",
Current = normaliseComboColourBrightness
},
new SettingsSlider<float>
{
LabelText = "Combo colour brightness",
Current = config.GetBindable<float>(OsuSetting.ComboColourBrightness),
DisplayAsPercentage = true
Current = comboColourBrightness,
DisplayAsPercentage = true,
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
normaliseComboColourBrightness.BindValueChanged(normalise => comboColourBrightness.Disabled = !normalise.NewValue, true);
}
}
}

View File

@ -129,6 +129,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
private readonly Bindable<int> comboIndexBindable = new Bindable<int>();
private readonly Bindable<float> positionalHitsoundsLevel = new Bindable<float>();
private readonly Bindable<bool> normaliseComboColourBrightness = new Bindable<bool>();
private readonly Bindable<float> comboColourBrightness = new Bindable<float>();
private readonly Bindable<int> comboIndexWithOffsetsBindable = new Bindable<int>();
@ -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;
}