mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Merge pull request #17930 from peppy/fix-song-select-music-control
Fix nested song select in first-run dialog fiddling with global audio
This commit is contained in:
commit
07462384e8
@ -62,7 +62,7 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new SampleScreenContainer(new PinnedMainMenu()),
|
new SampleScreenContainer(new PinnedMainMenu()),
|
||||||
new SampleScreenContainer(new PlaySongSelect()),
|
new SampleScreenContainer(new NestedSongSelect()),
|
||||||
},
|
},
|
||||||
// TODO: add more screens here in the future (gameplay / results)
|
// TODO: add more screens here in the future (gameplay / results)
|
||||||
// requires a bit more consideration to isolate their behaviour from the "parent" game.
|
// requires a bit more consideration to isolate their behaviour from the "parent" game.
|
||||||
@ -95,6 +95,11 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class NestedSongSelect : PlaySongSelect
|
||||||
|
{
|
||||||
|
protected override bool ControlGlobalMusic => false;
|
||||||
|
}
|
||||||
|
|
||||||
private class PinnedMainMenu : MainMenu
|
private class PinnedMainMenu : MainMenu
|
||||||
{
|
{
|
||||||
public override void OnEntering(ScreenTransitionEvent e)
|
public override void OnEntering(ScreenTransitionEvent e)
|
||||||
|
@ -50,6 +50,12 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public FilterControl FilterControl { get; private set; }
|
public FilterControl FilterControl { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this song select instance should take control of the global track,
|
||||||
|
/// applying looping and preview offsets.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool ControlGlobalMusic => true;
|
||||||
|
|
||||||
protected virtual bool ShowFooter => true;
|
protected virtual bool ShowFooter => true;
|
||||||
|
|
||||||
protected virtual bool DisplayStableImportPrompt => legacyImportManager?.SupportsImportFromStable == true;
|
protected virtual bool DisplayStableImportPrompt => legacyImportManager?.SupportsImportFromStable == true;
|
||||||
@ -604,15 +610,18 @@ namespace osu.Game.Screens.Select
|
|||||||
BeatmapDetails.Refresh();
|
BeatmapDetails.Refresh();
|
||||||
|
|
||||||
beginLooping();
|
beginLooping();
|
||||||
music.ResetTrackAdjustments();
|
|
||||||
|
|
||||||
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
||||||
{
|
{
|
||||||
updateComponentFromBeatmap(Beatmap.Value);
|
updateComponentFromBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
// restart playback on returning to song select, regardless.
|
if (ControlGlobalMusic)
|
||||||
// not sure this should be a permanent thing (we may want to leave a user pause paused even on returning)
|
{
|
||||||
music.Play(requestedByUser: true);
|
// restart playback on returning to song select, regardless.
|
||||||
|
// not sure this should be a permanent thing (we may want to leave a user pause paused even on returning)
|
||||||
|
music.ResetTrackAdjustments();
|
||||||
|
music.Play(requestedByUser: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.FadeIn(250);
|
this.FadeIn(250);
|
||||||
@ -663,6 +672,9 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void beginLooping()
|
private void beginLooping()
|
||||||
{
|
{
|
||||||
|
if (!ControlGlobalMusic)
|
||||||
|
return;
|
||||||
|
|
||||||
Debug.Assert(!isHandlingLooping);
|
Debug.Assert(!isHandlingLooping);
|
||||||
|
|
||||||
isHandlingLooping = true;
|
isHandlingLooping = true;
|
||||||
@ -733,6 +745,9 @@ namespace osu.Game.Screens.Select
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void ensurePlayingSelected()
|
private void ensurePlayingSelected()
|
||||||
{
|
{
|
||||||
|
if (!ControlGlobalMusic)
|
||||||
|
return;
|
||||||
|
|
||||||
ITrack track = music.CurrentTrack;
|
ITrack track = music.CurrentTrack;
|
||||||
|
|
||||||
bool isNewTrack = !lastTrack.TryGetTarget(out var last) || last != track;
|
bool isNewTrack = !lastTrack.TryGetTarget(out var last) || last != track;
|
||||||
|
Loading…
Reference in New Issue
Block a user