1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

added music during pause

This commit is contained in:
BananeVolante 2020-06-12 19:17:52 +02:00
parent 527577d7c3
commit 2feaf2c74a

View File

@ -78,6 +78,8 @@ namespace osu.Game.Screens.Play
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
private SampleChannel sampleRestart; private SampleChannel sampleRestart;
private SampleChannel samplePause;
public BreakOverlay BreakOverlay; public BreakOverlay BreakOverlay;
@ -161,6 +163,9 @@ namespace osu.Game.Screens.Play
return; return;
sampleRestart = audio.Samples.Get(@"Gameplay/restart"); sampleRestart = audio.Samples.Get(@"Gameplay/restart");
samplePause = audio.Samples.Get(@"Gameplay/pause-loop");
samplePause.Looping = true;
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel); mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
@ -407,7 +412,11 @@ namespace osu.Game.Screens.Play
if (canPause) if (canPause)
Pause(); Pause();
else else
{
samplePause?.Stop();
Logger.LogPrint(@"_______sample stopped in performUserRequestedExit");
this.Exit(); this.Exit();
}
} }
/// <summary> /// <summary>
@ -416,6 +425,8 @@ namespace osu.Game.Screens.Play
/// </summary> /// </summary>
public void Restart() public void Restart()
{ {
Logger.LogPrint(@"_______sample stopped in Restart");
samplePause?.Stop();
sampleRestart?.Play(); sampleRestart?.Play();
RestartRequested?.Invoke(); RestartRequested?.Invoke();
@ -564,6 +575,8 @@ namespace osu.Game.Screens.Play
GameplayClockContainer.Stop(); GameplayClockContainer.Stop();
PauseOverlay.Show(); PauseOverlay.Show();
lastPauseActionTime = GameplayClockContainer.GameplayClock.CurrentTime; lastPauseActionTime = GameplayClockContainer.GameplayClock.CurrentTime;
samplePause?.Play();
} }
public void Resume() public void Resume()
@ -583,6 +596,8 @@ namespace osu.Game.Screens.Play
{ {
GameplayClockContainer.Start(); GameplayClockContainer.Start();
IsResuming = false; IsResuming = false;
Logger.LogPrint(@"_______sample stopped in Resume");
samplePause?.Stop();
} }
} }