mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 22:03:01 +08:00
Merge branch 'master' into fix-index-transfer
This commit is contained in:
commit
45a5957ad7
@ -75,8 +75,6 @@ namespace osu.Game.Overlays.Music
|
||||
},
|
||||
};
|
||||
|
||||
list.Items.BindTo(beatmapSets);
|
||||
|
||||
filter.Search.OnCommit = (sender, newText) =>
|
||||
{
|
||||
BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
||||
@ -87,7 +85,13 @@ namespace osu.Game.Overlays.Music
|
||||
beatmap.Value.Track.Restart();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
list.Items.BindTo(beatmapSets);
|
||||
beatmap.BindValueChanged(working => list.SelectedSet.Value = working.NewValue.BeatmapSetInfo, true);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,16 @@ namespace osu.Game.Overlays
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
|
||||
public IBindableList<BeatmapSetInfo> BeatmapSets => beatmapSets;
|
||||
public IBindableList<BeatmapSetInfo> BeatmapSets
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LoadState < LoadState.Ready)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSets)} should not be accessed before the music controller is loaded.");
|
||||
|
||||
return beatmapSets;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Point in time after which the current track will be restarted on triggering a "previous track" action.
|
||||
@ -54,16 +63,18 @@ namespace osu.Game.Overlays
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets().OrderBy(_ => RNG.Next()));
|
||||
beatmaps.ItemAdded += handleBeatmapAdded;
|
||||
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
||||
|
||||
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets().OrderBy(_ => RNG.Next()));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
beatmap.BindValueChanged(beatmapChanged, true);
|
||||
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -82,11 +93,16 @@ namespace osu.Game.Overlays
|
||||
/// </summary>
|
||||
public bool IsPlaying => current?.Track.IsRunning ?? false;
|
||||
|
||||
private void handleBeatmapAdded(BeatmapSetInfo set) =>
|
||||
Schedule(() => beatmapSets.Add(set));
|
||||
private void handleBeatmapAdded(BeatmapSetInfo set) => Schedule(() =>
|
||||
{
|
||||
if (!beatmapSets.Contains(set))
|
||||
beatmapSets.Add(set);
|
||||
});
|
||||
|
||||
private void handleBeatmapRemoved(BeatmapSetInfo set) =>
|
||||
Schedule(() => beatmapSets.RemoveAll(s => s.ID == set.ID));
|
||||
private void handleBeatmapRemoved(BeatmapSetInfo set) => Schedule(() =>
|
||||
{
|
||||
beatmapSets.RemoveAll(s => s.ID == set.ID);
|
||||
});
|
||||
|
||||
private ScheduledDelegate seekDelegate;
|
||||
|
||||
|
@ -58,6 +58,9 @@ namespace osu.Game.Overlays
|
||||
[Resolved]
|
||||
private Bindable<WorkingBeatmap> beatmap { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public NowPlayingOverlay()
|
||||
{
|
||||
Width = 400;
|
||||
@ -65,7 +68,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -182,15 +185,15 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
playlist.BeatmapSets.BindTo(musicController.BeatmapSets);
|
||||
playlist.State.ValueChanged += s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
playlist.BeatmapSets.BindTo(musicController.BeatmapSets);
|
||||
playlist.State.BindValueChanged(s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint), true);
|
||||
|
||||
beatmap.BindDisabledChanged(beatmapDisabledChanged, true);
|
||||
|
||||
musicController.TrackChanged += trackChanged;
|
||||
|
Loading…
Reference in New Issue
Block a user