1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Fix combo break sound not playing after rewind

This commit is contained in:
Dean Herbert 2020-11-13 13:35:01 +09:00
parent 43626573df
commit 4b5743d993
2 changed files with 17 additions and 6 deletions

View File

@ -17,8 +17,9 @@ namespace osu.Game.Screens.Play
private SkinnableSound comboBreakSample;
private Bindable<bool> alwaysPlay;
private bool firstTime = true;
private Bindable<bool> alwaysPlayFirst;
private double? firstBreakTime;
public ComboEffects(ScoreProcessor processor)
{
@ -29,7 +30,7 @@ namespace osu.Game.Screens.Play
private void load(OsuConfigManager config)
{
InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("Gameplay/combobreak"));
alwaysPlay = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak);
alwaysPlayFirst = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak);
}
protected override void LoadComplete()
@ -41,11 +42,21 @@ namespace osu.Game.Screens.Play
[Resolved(canBeNull: true)]
private ISamplePlaybackDisabler samplePlaybackDisabler { get; set; }
[Resolved]
private GameplayClock gameplayClock { get; set; }
private void onComboChange(ValueChangedEvent<int> combo)
{
if (combo.NewValue == 0 && (combo.OldValue > 20 || (alwaysPlay.Value && firstTime)))
// handle the case of rewinding before the first combo break time.
if (gameplayClock.CurrentTime < firstBreakTime)
firstBreakTime = null;
if (gameplayClock.ElapsedFrameTime < 0)
return;
if (combo.NewValue == 0 && (combo.OldValue > 20 || (alwaysPlayFirst.Value && firstBreakTime == null)))
{
firstTime = false;
firstBreakTime = gameplayClock.CurrentTime;
// combo break isn't a pausable sound itself as we want to let it play out.
// we still need to disable during seeks, though.

View File

@ -302,12 +302,12 @@ namespace osu.Game.Screens.Play
{
ScoreProcessor,
HealthProcessor,
new ComboEffects(ScoreProcessor),
breakTracker = new BreakTracker(DrawableRuleset.GameplayStartTime, ScoreProcessor)
{
Breaks = working.Beatmap.Breaks
}
}),
new ComboEffects(ScoreProcessor)
}
};