1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Autoscroll playlist on song change

This commit is contained in:
Roman Kapustin 2019-10-05 23:53:05 +03:00
parent 8c3caed2e0
commit bdea75b995
4 changed files with 42 additions and 2 deletions

View File

@ -117,6 +117,8 @@ namespace osu.Game.Configuration
Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
Set(OsuSetting.FollowPlayback, true);
}
public OsuConfigManager(Storage storage)
@ -186,6 +188,7 @@ namespace osu.Game.Configuration
UIScale,
IntroSequence,
UIHoldActivationDelay,
HitLighting
HitLighting,
FollowPlayback
}
}

View File

@ -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

View File

@ -0,0 +1,27 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Settings.Sections.Audio
{
public class PlaylistSettings : SettingsSubsection
{
protected override string Header => "Playlist";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Follow playback",
Bindable = config.GetBindable<bool>(OsuSetting.FollowPlayback)
}
};
}
}
}

View File

@ -20,6 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections
new VolumeSettings(),
new OffsetSettings(),
new MainMenuSettings(),
new PlaylistSettings()
};
}
}