removed looping if only one song is in the list (temporarily)

It had one problem in relation to SongSelect disabling it when left and in general that topic belongs to another PR.
This commit is contained in:
Aergwyn 2017-12-03 16:41:21 +01:00
parent 9d13bf3602
commit 14096c90cc
2 changed files with 13 additions and 10 deletions

View File

@ -35,7 +35,11 @@ namespace osu.Game.Overlays.Music
set { base.Padding = value; } set { base.Padding = value; }
} }
public IEnumerable<BeatmapSetInfo> BeatmapSets { set { items.Sets = value; } } public IEnumerable<BeatmapSetInfo> BeatmapSets
{
get { return items.Sets; }
set { items.Sets = value; }
}
public BeatmapSetInfo FirstVisibleSet => items.FirstVisibleSet; public BeatmapSetInfo FirstVisibleSet => items.FirstVisibleSet;
public BeatmapSetInfo NextSet => items.NextSet; public BeatmapSetInfo NextSet => items.NextSet;
@ -81,6 +85,7 @@ namespace osu.Game.Overlays.Music
public IEnumerable<BeatmapSetInfo> Sets public IEnumerable<BeatmapSetInfo> Sets
{ {
get { return items.Select(x => x.BeatmapSetInfo).ToList(); }
set set
{ {
items.Clear(); items.Clear();

View File

@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Music
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>(); private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
public IEnumerable<BeatmapSetInfo> BeatmapSets; public IEnumerable<BeatmapSetInfo> BeatmapSets => list.BeatmapSets;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours) private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours)
@ -74,11 +74,10 @@ namespace osu.Game.Overlays.Music
}, },
}; };
beatmaps.BeatmapSetAdded += s => Schedule(() => list.AddBeatmapSet(s)); beatmaps.BeatmapSetAdded += delegate (BeatmapSetInfo set) { list.AddBeatmapSet(set); };
beatmaps.BeatmapSetRemoved += s => Schedule(() => list.RemoveBeatmapSet(s)); beatmaps.BeatmapSetRemoved += delegate (BeatmapSetInfo set) { list.RemoveBeatmapSet(set); };
list.BeatmapSets = BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
list.BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
beatmapBacking.BindTo(game.Beatmap); beatmapBacking.BindTo(game.Beatmap);
@ -121,7 +120,7 @@ namespace osu.Game.Overlays.Music
return; return;
} }
playSpecified(set.Beatmaps[0]); playSpecified(set.Beatmaps.First());
} }
public void PlayPrevious() public void PlayPrevious()
@ -130,7 +129,7 @@ namespace osu.Game.Overlays.Music
if (playable != null) if (playable != null)
{ {
playSpecified(playable.Beatmaps[0]); playSpecified(playable.Beatmaps.First());
list.SelectedSet = playable; list.SelectedSet = playable;
} }
} }
@ -141,7 +140,7 @@ namespace osu.Game.Overlays.Music
if (playable != null) if (playable != null)
{ {
playSpecified(playable.Beatmaps[0]); playSpecified(playable.Beatmaps.First());
list.SelectedSet = playable; list.SelectedSet = playable;
} }
} }
@ -149,7 +148,6 @@ namespace osu.Game.Overlays.Music
private void playSpecified(BeatmapInfo info) private void playSpecified(BeatmapInfo info)
{ {
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(info, beatmapBacking); beatmapBacking.Value = beatmaps.GetWorkingBeatmap(info, beatmapBacking);
beatmapBacking.Value.Track.Looping = BeatmapSets?.Count() == 1;
beatmapBacking.Value.Track.Start(); beatmapBacking.Value.Track.Start();
} }
} }