mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Autoscroll playlist on song change
This commit is contained in:
@ -11,6 +11,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osuTK;
|
||||
|
||||
@ -52,6 +53,8 @@ namespace osu.Game.Overlays.Music
|
||||
|
||||
private IBindableList<BeatmapSetInfo> beatmaps;
|
||||
|
||||
private IBindable<bool> followPlayback;
|
||||
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; }
|
||||
|
||||
@ -76,8 +79,10 @@ namespace osu.Game.Overlays.Music
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, OsuConfigManager configManager)
|
||||
{
|
||||
followPlayback = configManager.GetBindable<bool>(OsuSetting.FollowPlayback);
|
||||
|
||||
beatmaps = musicController.BeatmapSets.GetBoundCopy();
|
||||
beatmaps.ItemsAdded += i => i.ForEach(addBeatmapSet);
|
||||
beatmaps.ItemsRemoved += i => i.ForEach(removeBeatmapSet);
|
||||
@ -109,7 +114,11 @@ namespace osu.Game.Overlays.Music
|
||||
private void updateSelectedSet()
|
||||
{
|
||||
foreach (PlaylistItem s in items.Children)
|
||||
{
|
||||
s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value.BeatmapSetInfo?.ID;
|
||||
if (s.Selected && followPlayback.Value)
|
||||
ScrollIntoView(s);
|
||||
}
|
||||
}
|
||||
|
||||
public string SearchTerm
|
||||
|
Reference in New Issue
Block a user