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:
parent
43626573df
commit
4b5743d993
@ -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.
|
||||
|
@ -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)
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user