Merge branch 'match-playlist' into match-detail-area

This commit is contained in:
smoogipoo
2020-02-14 17:04:22 +09:00
67 changed files with 1610 additions and 624 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -21,11 +22,11 @@ namespace osu.Game.Screens.Select
public string ShortTitle => "song selection";
public override string Title => ShortTitle.Humanize();
[Resolved(typeof(Room))]
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
public override bool AllowEditing => false;
[Resolved(typeof(Room), nameof(Room.Playlist))]
protected BindableList<PlaylistItem> Playlist { get; private set; }
[Resolved]
private BeatmapManager beatmaps { get; set; }
@ -40,8 +41,8 @@ namespace osu.Game.Screens.Select
{
var item = new PlaylistItem
{
Beatmap = Beatmap.Value.BeatmapInfo,
Ruleset = Ruleset.Value,
Beatmap = { Value = Beatmap.Value.BeatmapInfo },
Ruleset = { Value = Ruleset.Value },
RulesetID = Ruleset.Value.ID ?? 0
};
@ -60,11 +61,13 @@ namespace osu.Game.Screens.Select
if (base.OnExiting(next))
return true;
if (CurrentItem.Value != null)
var firstItem = Playlist.FirstOrDefault();
if (firstItem != null)
{
Ruleset.Value = CurrentItem.Value.Ruleset;
Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value.Beatmap);
Mods.Value = CurrentItem.Value.RequiredMods?.ToArray() ?? Array.Empty<Mod>();
Ruleset.Value = firstItem.Ruleset.Value;
Beatmap.Value = beatmaps.GetWorkingBeatmap(firstItem.Beatmap.Value);
Mods.Value = firstItem.RequiredMods?.ToArray() ?? Array.Empty<Mod>();
}
return false;