mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 13:42:56 +08:00
Remove necessity for MusicController to be always visible
This commit is contained in:
parent
35ce032be1
commit
f2200594c9
@ -184,6 +184,8 @@ namespace osu.Game
|
||||
LocalConfig.BindWith(OsuSetting.VolumeInactive, userInactiveVolume);
|
||||
|
||||
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
||||
|
||||
Beatmap.BindValueChanged(beatmapChanged, true);
|
||||
}
|
||||
|
||||
private ExternalLinkOpener externalLinkOpener;
|
||||
@ -284,6 +286,23 @@ namespace osu.Game
|
||||
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
||||
}
|
||||
|
||||
#region Beatmap jukebox progression
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
||||
{
|
||||
var nextBeatmap = beatmap.NewValue;
|
||||
if (nextBeatmap?.Track != null)
|
||||
nextBeatmap.Track.Completed += currentTrackCompleted;
|
||||
}
|
||||
|
||||
private void currentTrackCompleted()
|
||||
{
|
||||
if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
|
||||
musicController.NextTrack();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ScheduledDelegate performFromMainMenuTask;
|
||||
|
||||
/// <summary>
|
||||
@ -446,7 +465,7 @@ namespace osu.Game
|
||||
Origin = Anchor.TopRight,
|
||||
}, rightFloatingOverlayContent.Add, true);
|
||||
|
||||
loadComponentSingleFile(new MusicController
|
||||
loadComponentSingleFile(musicController = new MusicController
|
||||
{
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -719,8 +738,11 @@ namespace osu.Game
|
||||
private Container topMostOverlayContent;
|
||||
|
||||
private FrameworkConfigManager frameworkConfig;
|
||||
|
||||
private ScalingContainer screenContainer;
|
||||
|
||||
private MusicController musicController;
|
||||
|
||||
protected override bool OnExiting()
|
||||
{
|
||||
if (screenStack.CurrentScreen is Loader)
|
||||
|
@ -70,9 +70,6 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Width = 400;
|
||||
Margin = new MarginPadding(10);
|
||||
|
||||
// required to let MusicController handle beatmap cycling.
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -349,18 +346,11 @@ namespace osu.Game.Overlays
|
||||
|
||||
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
|
||||
}
|
||||
|
||||
//current.Track.Completed -= currentTrackCompleted;
|
||||
}
|
||||
|
||||
current = beatmap.NewValue;
|
||||
|
||||
if (current != null)
|
||||
current.Track.Completed += currentTrackCompleted;
|
||||
|
||||
progressBar.CurrentTime = 0;
|
||||
|
||||
updateDisplay(current, direction);
|
||||
updateDisplay(current = beatmap.NewValue, direction);
|
||||
updateAudioAdjustments();
|
||||
|
||||
queuedDirection = null;
|
||||
@ -378,12 +368,6 @@ namespace osu.Game.Overlays
|
||||
mod.ApplyToClock(track);
|
||||
}
|
||||
|
||||
private void currentTrackCompleted() => Schedule(() =>
|
||||
{
|
||||
if (!current.Track.Looping && !beatmap.Disabled && beatmapSets.Any())
|
||||
next();
|
||||
});
|
||||
|
||||
private ScheduledDelegate pendingBeatmapSwitch;
|
||||
|
||||
private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
|
||||
@ -447,10 +431,6 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
// This is here mostly as a performance fix.
|
||||
// If the playlist is not hidden it will update children even when the music controller is hidden (due to AlwaysPresent).
|
||||
playlist.Hide();
|
||||
|
||||
this.FadeOut(transition_length, Easing.OutQuint);
|
||||
dragContainer.ScaleTo(0.9f, transition_length, Easing.OutQuint);
|
||||
}
|
||||
@ -548,5 +528,10 @@ namespace osu.Game.Overlays
|
||||
return base.OnDragEnd(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play the next random or playlist track.
|
||||
/// </summary>
|
||||
public void NextTrack() => next();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user