mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:04:06 +08:00
Merge pull request #1 from Desconocidosmh/Fix-music-playing-while-exiting-from-editor
Fix music playing while exiting from editor
This commit is contained in:
commit
52b54506c6
@ -306,7 +306,7 @@ namespace osu.Game
|
|||||||
private void currentTrackCompleted()
|
private void currentTrackCompleted()
|
||||||
{
|
{
|
||||||
if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
|
if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
|
||||||
musicController.NextTrack();
|
MusicController.NextTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -484,7 +484,7 @@ namespace osu.Game
|
|||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
}, rightFloatingOverlayContent.Add, true);
|
}, rightFloatingOverlayContent.Add, true);
|
||||||
|
|
||||||
loadComponentSingleFile(musicController = new MusicController
|
loadComponentSingleFile(MusicController = new MusicController
|
||||||
{
|
{
|
||||||
GetToolbarHeight = () => ToolbarOffset,
|
GetToolbarHeight = () => ToolbarOffset,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -752,7 +752,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
private ScalingContainer screenContainer;
|
private ScalingContainer screenContainer;
|
||||||
|
|
||||||
private MusicController musicController;
|
public MusicController MusicController { get; private set; }
|
||||||
|
|
||||||
protected override bool OnExiting()
|
protected override bool OnExiting()
|
||||||
{
|
{
|
||||||
|
@ -66,6 +66,8 @@ namespace osu.Game.Overlays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<float> GetToolbarHeight;
|
public Func<float> GetToolbarHeight;
|
||||||
|
|
||||||
|
public bool UserRequestedPause { get; private set; }
|
||||||
|
|
||||||
public MusicController()
|
public MusicController()
|
||||||
{
|
{
|
||||||
Width = 400;
|
Width = 400;
|
||||||
@ -287,6 +289,8 @@ namespace osu.Game.Overlays
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserRequestedPause = track.IsRunning;
|
||||||
|
|
||||||
if (track.IsRunning)
|
if (track.IsRunning)
|
||||||
track.Stop();
|
track.Stop();
|
||||||
else
|
else
|
||||||
|
@ -243,21 +243,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
Background.FadeColour(Color4.White, 500);
|
Background.FadeColour(Color4.White, 500);
|
||||||
|
|
||||||
if (Beatmap.Value.Track != null)
|
|
||||||
{
|
|
||||||
if (isExitingGame)
|
|
||||||
{
|
|
||||||
Beatmap.Value.Track.Stop();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Beatmap.Value.Track.Tempo.Value = 1;
|
|
||||||
Beatmap.Value.Track.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
host.Exiting -= onExitingGame;
|
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
var track = Beatmap.Value.Track;
|
var track = Beatmap.Value.Track;
|
||||||
var metadata = Beatmap.Value.Metadata;
|
var metadata = Beatmap.Value.Metadata;
|
||||||
|
|
||||||
if (last is Intro && track != null)
|
if (last is Intro && track != null && !Game.MusicController.UserRequestedPause)
|
||||||
{
|
{
|
||||||
if (!track.IsRunning)
|
if (!track.IsRunning)
|
||||||
{
|
{
|
||||||
@ -189,6 +189,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
//we may have consumed our preloaded instance, so let's make another.
|
//we may have consumed our preloaded instance, so let's make another.
|
||||||
preloadSongSelect();
|
preloadSongSelect();
|
||||||
|
|
||||||
|
ResumeIfNoUserPauseRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public virtual bool CursorVisible => true;
|
public virtual bool CursorVisible => true;
|
||||||
|
|
||||||
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
protected new OsuGame Game => base.Game as OsuGame;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="UserActivity"/> to set the user's activity automatically to when this screen is entered
|
/// The <see cref="UserActivity"/> to set the user's activity automatically to when this screen is entered
|
||||||
@ -179,6 +179,15 @@ namespace osu.Game.Screens
|
|||||||
api.Activity.Value = activity;
|
api.Activity.Value = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void ResumeIfNoUserPauseRequested()
|
||||||
|
{
|
||||||
|
if (Beatmap.Value.Track != null && !Game.MusicController.UserRequestedPause)
|
||||||
|
{
|
||||||
|
Beatmap.Value.Track.Tempo.Value = 1;
|
||||||
|
Beatmap.Value.Track.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when this screen was entered or resumed and the logo state is required to be adjusted.
|
/// Fired when this screen was entered or resumed and the logo state is required to be adjusted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -426,6 +426,8 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
|
ResumeIfNoUserPauseRequested();
|
||||||
|
|
||||||
this.FadeInFromZero(250);
|
this.FadeInFromZero(250);
|
||||||
FilterControl.Activate();
|
FilterControl.Activate();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user