From 7dd1479050e3ecd1b61b3476c5aae69a33b30b67 Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Wed, 26 Jun 2019 00:20:33 -0500 Subject: [PATCH] Add combobreak sound --- osu.Game/Screens/Play/Player.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c3e351a0ca..530145a604 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -66,6 +66,7 @@ namespace osu.Game.Screens.Play private IAPIProvider api; private SampleChannel sampleRestart; + private SampleChannel sampleComboBreak; protected ScoreProcessor ScoreProcessor { get; private set; } protected DrawableRuleset DrawableRuleset { get; private set; } @@ -80,6 +81,8 @@ namespace osu.Game.Screens.Play [Cached(Type = typeof(IBindable>))] protected new readonly Bindable> Mods = new Bindable>(Array.Empty()); + protected readonly BindableInt Combo = new BindableInt(); + private readonly bool allowPause; private readonly bool showResults; @@ -107,12 +110,15 @@ namespace osu.Game.Screens.Play return; sampleRestart = audio.Samples.Get(@"Gameplay/restart"); + sampleComboBreak = audio.Samples.Get(@"Gameplay/combobreak"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); ScoreProcessor = DrawableRuleset.CreateScoreProcessor(); ScoreProcessor.Mods.BindTo(Mods); + ScoreProcessor.Combo.BindTo(Combo); + Combo.BindValueChanged(onComboChange); if (!ScoreProcessor.Mode.Disabled) config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); @@ -264,6 +270,12 @@ namespace osu.Game.Screens.Play private ScheduledDelegate onCompletionEvent; + private void onComboChange(ValueChangedEvent combo) + { + if (combo.NewValue == 0 && combo.OldValue > 20) + sampleComboBreak?.Play(); + } + private void onCompletion() { // Only show the completion screen if the player hasn't failed