1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

Split out code so base methods aren't called

This commit is contained in:
Dan Balasescu 2021-12-03 16:40:20 +09:00
parent 0a1304b92a
commit 487a71312e

View File

@ -86,7 +86,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
if (firstPopulation)
{
foreach (var item in Room.Playlist)
PlaylistItemAdded(item);
addItemToLists(item);
firstPopulation = false;
}
@ -95,7 +95,25 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
protected override void PlaylistItemAdded(MultiplayerPlaylistItem item)
{
base.PlaylistItemAdded(item);
addItemToLists(item);
}
protected override void PlaylistItemRemoved(long item)
{
base.PlaylistItemRemoved(item);
removeItemFromLists(item);
}
protected override void PlaylistItemChanged(MultiplayerPlaylistItem item)
{
base.PlaylistItemChanged(item);
removeItemFromLists(item.ID);
addItemToLists(item);
}
private void addItemToLists(MultiplayerPlaylistItem item)
{
var apiItem = Playlist.Single(i => i.ID == item.ID);
if (item.Expired)
@ -104,20 +122,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
queueList.Items.Add(apiItem);
}
protected override void PlaylistItemRemoved(long item)
private void removeItemFromLists(long item)
{
base.PlaylistItemRemoved(item);
queueList.Items.RemoveAll(i => i.ID == item);
historyList.Items.RemoveAll(i => i.ID == item);
}
protected override void PlaylistItemChanged(MultiplayerPlaylistItem item)
{
base.PlaylistItemChanged(item);
PlaylistItemRemoved(item.ID);
PlaylistItemAdded(item);
}
}
}