1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 08:42:55 +08:00

Merge pull request #1649 from Aergwyn/fix-playlist-audio-issue

Fix MusicController constantly trying to start a track
This commit is contained in:
Dean Herbert 2017-12-05 01:11:13 +09:00 committed by GitHub
commit 634700fae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 17 deletions

@ -1 +1 @@
Subproject commit 8c16e6244d8ca884a743a0d5a1f1ee485f18655c
Subproject commit d2c6d11f3bcc54a5aeb5a16d6563036c7e1f4759

View File

@ -35,7 +35,11 @@ namespace osu.Game.Overlays.Music
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 NextSet => items.NextSet;
@ -48,7 +52,7 @@ namespace osu.Game.Overlays.Music
}
public void AddBeatmapSet(BeatmapSetInfo beatmapSet) => items.AddBeatmapSet(beatmapSet);
public bool RemoveBeatmapSet(BeatmapSetInfo beatmapSet) => items.RemoveBeatmapSet(beatmapSet);
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) => items.RemoveBeatmapSet(beatmapSet);
public void Filter(string searchTerm) => items.SearchTerm = searchTerm;
@ -81,6 +85,7 @@ namespace osu.Game.Overlays.Music
public IEnumerable<BeatmapSetInfo> Sets
{
get { return items.Select(x => x.BeatmapSetInfo).ToList(); }
set
{
items.Clear();
@ -103,12 +108,11 @@ namespace osu.Game.Overlays.Music
});
}
public bool RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
{
var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.ID == beatmapSet.ID);
if (itemToRemove == null)
return false;
return items.Remove(itemToRemove);
if (itemToRemove != null)
items.Remove(itemToRemove);
}
public BeatmapSetInfo SelectedSet
@ -230,6 +234,7 @@ namespace osu.Game.Overlays.Music
private class ItemSearchContainer : FillFlowContainer<PlaylistItem>, IHasFilterableChildren
{
public IEnumerable<string> FilterTerms => new string[] { };
public bool MatchingFilter
{
set

View File

@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Music
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
public IEnumerable<BeatmapSetInfo> BeatmapSets;
public IEnumerable<BeatmapSetInfo> BeatmapSets => list.BeatmapSets;
[BackgroundDependencyLoader]
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.BeatmapSetRemoved += s => Schedule(() => list.RemoveBeatmapSet(s));
list.BeatmapSets = BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
beatmaps.BeatmapSetAdded += list.AddBeatmapSet;
beatmaps.BeatmapSetRemoved += list.RemoveBeatmapSet;
list.BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
beatmapBacking.BindTo(game.Beatmap);
@ -121,7 +120,7 @@ namespace osu.Game.Overlays.Music
return;
}
playSpecified(set.Beatmaps[0]);
playSpecified(set.Beatmaps.First());
}
public void PlayPrevious()
@ -130,7 +129,7 @@ namespace osu.Game.Overlays.Music
if (playable != null)
{
playSpecified(playable.Beatmaps[0]);
playSpecified(playable.Beatmaps.First());
list.SelectedSet = playable;
}
}
@ -141,7 +140,7 @@ namespace osu.Game.Overlays.Music
if (playable != null)
{
playSpecified(playable.Beatmaps[0]);
playSpecified(playable.Beatmaps.First());
list.SelectedSet = playable;
}
}
@ -149,7 +148,7 @@ namespace osu.Game.Overlays.Music
private void playSpecified(BeatmapInfo info)
{
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(info, beatmapBacking);
beatmapBacking.Value.Track.Start();
beatmapBacking.Value.Track.Restart();
}
}

View File

@ -251,7 +251,7 @@ namespace osu.Game.Overlays
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
if (track.HasCompleted && !track.Looping && !beatmapBacking.Disabled)
if (track.HasCompleted && !beatmapBacking.Disabled && playlist.BeatmapSets.Any())
next();
}
else