1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

User setting for always playing first combo break

This commit is contained in:
Endrik Tombak 2020-04-19 12:23:41 +03:00
parent 149efec985
commit f893d523f5
3 changed files with 19 additions and 3 deletions

View File

@ -91,6 +91,7 @@ namespace osu.Game.Configuration
Set(OsuSetting.FadePlayfieldWhenHealthLow, true);
Set(OsuSetting.KeyOverlay, false);
Set(OsuSetting.PositionalHitSounds, true);
Set(OsuSetting.AlwaysPlayComboBreak, false);
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
Set(OsuSetting.FloatingComments, false);
@ -180,6 +181,7 @@ namespace osu.Game.Configuration
ShowStoryboard,
KeyOverlay,
PositionalHitSounds,
AlwaysPlayComboBreak,
ScoreMeter,
FloatingComments,
ShowInterface,

View File

@ -67,6 +67,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
LabelText = "Positional hitsounds",
Bindable = config.GetBindable<bool>(OsuSetting.PositionalHitSounds)
},
new SettingsCheckbox
{
LabelText = "Always play first combo break sound",
Keywords = new[] { "regardless", "combobreak.wav" },
Bindable = config.GetBindable<bool>(OsuSetting.AlwaysPlayComboBreak)
},
new SettingsEnumDropdown<ScoreMeterType>
{
LabelText = "Score meter type",

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Game.Audio;
using osu.Game.Configuration;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
@ -16,27 +17,34 @@ namespace osu.Game.Screens.Play
private SkinnableSound comboBreakSample;
private Bindable<bool> alwaysPlay;
private bool firstTime = true;
public ComboEffects(ScoreProcessor processor)
{
this.processor = processor;
}
[BackgroundDependencyLoader]
private void load()
private void load(OsuConfigManager config)
{
InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak"));
alwaysPlay = config.GetBindable<bool>(OsuSetting.AlwaysPlayComboBreak);
}
protected override void LoadComplete()
{
base.LoadComplete();
processor.Combo.BindValueChanged(onComboChange, true);
processor.Combo.BindValueChanged(onComboChange);
}
private void onComboChange(ValueChangedEvent<int> combo)
{
if (combo.NewValue == 0 && combo.OldValue > 20)
if (combo.NewValue == 0 && (combo.OldValue > 20 || alwaysPlay.Value && firstTime))
{
comboBreakSample?.Play();
firstTime = false;
}
}
}
}