mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Fix playlist not being handled correctly for non-joined cases
This commit is contained in:
@ -539,10 +539,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
var allowedMods = settings.AllowedMods.Select(m => m.ToMod(ruleset));
|
var allowedMods = settings.AllowedMods.Select(m => m.ToMod(ruleset));
|
||||||
|
|
||||||
// Update an existing playlist item from the API room, or create a new item.
|
// Update an existing playlist item from the API room, or create a new item.
|
||||||
var playlistItem = apiRoom.Playlist.FirstOrDefault(i => i.ID == settings.PlaylistItemId);
|
var playlistItem = apiRoom.Playlist.FirstOrDefault(i => i.ID == settings.PlaylistItemId) ?? new PlaylistItem();
|
||||||
|
|
||||||
if (playlistItem == null)
|
|
||||||
apiRoom.Playlist.Add(playlistItem = new PlaylistItem());
|
|
||||||
|
|
||||||
playlistItem.ID = settings.PlaylistItemId;
|
playlistItem.ID = settings.PlaylistItemId;
|
||||||
playlistItem.Beatmap.Value = beatmap;
|
playlistItem.Beatmap.Value = beatmap;
|
||||||
@ -552,6 +549,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
playlistItem.AllowedMods.Clear();
|
playlistItem.AllowedMods.Clear();
|
||||||
playlistItem.AllowedMods.AddRange(allowedMods);
|
playlistItem.AllowedMods.AddRange(allowedMods);
|
||||||
|
|
||||||
|
if (!apiRoom.Playlist.Contains(playlistItem))
|
||||||
|
apiRoom.Playlist.Add(playlistItem);
|
||||||
|
|
||||||
CurrentMatchPlayingItem.Value = playlistItem;
|
CurrentMatchPlayingItem.Value = playlistItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
@ -62,7 +62,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
Debug.Assert(SelectedItem != null);
|
Debug.Assert(SelectedItem != null);
|
||||||
SelectedItem.BindValueChanged(onSelectedItemChanged, true);
|
SelectedItem.BindValueChanged(_ => updateBeatmap());
|
||||||
|
Playlist.BindCollectionChanged((_, __) => updateBeatmap(), true);
|
||||||
|
|
||||||
Host.BindValueChanged(host =>
|
Host.BindValueChanged(host =>
|
||||||
{
|
{
|
||||||
@ -73,12 +74,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSelectedItemChanged(ValueChangedEvent<PlaylistItem> selectedItem)
|
private void updateBeatmap()
|
||||||
{
|
{
|
||||||
if (selectedItem.NewValue == null)
|
Debug.Assert(SelectedItem != null);
|
||||||
|
PlaylistItem item = SelectedItem.Value ?? Playlist.FirstOrDefault();
|
||||||
|
|
||||||
|
if (item == null)
|
||||||
beatmapPanelContainer.Clear();
|
beatmapPanelContainer.Clear();
|
||||||
else
|
else
|
||||||
beatmapPanelContainer.Child = new DrawableRoomPlaylistItem(selectedItem.NewValue, false, false);
|
beatmapPanelContainer.Child = new DrawableRoomPlaylistItem(item, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user