1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 11:42:55 +08:00

Merge pull request #10818 from peppy/fix-combo-break-rewind-replay

Fix combo break sound not playing a second time after rewinding before it
This commit is contained in:
Bartłomiej Dach 2020-11-13 22:26:17 +01:00 committed by GitHub
commit b9b47349ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
}
};