2020-12-20 14:36:56 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-08-12 10:48:15 +00:00
|
|
|
using System.Collections.Generic;
|
2022-05-27 11:18:46 +00:00
|
|
|
using System.ComponentModel;
|
2021-08-12 10:48:15 +00:00
|
|
|
using System.Linq;
|
2021-07-14 09:55:01 +00:00
|
|
|
using osu.Framework.Allocation;
|
2021-08-12 10:48:15 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2021-07-14 09:55:01 +00:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
using osu.Game.Online.API;
|
2020-12-25 04:38:11 +00:00
|
|
|
using osu.Game.Online.Rooms;
|
2021-08-13 08:39:09 +00:00
|
|
|
using osu.Game.Screens.OnlinePlay.Components;
|
2020-12-25 15:50:00 +00:00
|
|
|
using osu.Game.Screens.OnlinePlay.Lounge;
|
|
|
|
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
|
|
|
using osu.Game.Screens.OnlinePlay.Match;
|
2020-12-20 14:36:56 +00:00
|
|
|
|
2020-12-25 15:50:00 +00:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Playlists
|
2020-12-20 14:36:56 +00:00
|
|
|
{
|
2020-12-25 04:11:21 +00:00
|
|
|
public class PlaylistsLoungeSubScreen : LoungeSubScreen
|
2020-12-20 14:36:56 +00:00
|
|
|
{
|
2021-07-14 09:55:01 +00:00
|
|
|
[Resolved]
|
|
|
|
private IAPIProvider api { get; set; }
|
|
|
|
|
2021-08-12 10:48:15 +00:00
|
|
|
private Dropdown<PlaylistsCategory> categoryDropdown;
|
|
|
|
|
|
|
|
protected override IEnumerable<Drawable> CreateFilterControls()
|
|
|
|
{
|
|
|
|
categoryDropdown = new SlimEnumDropdown<PlaylistsCategory>
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.None,
|
|
|
|
Width = 160,
|
|
|
|
};
|
|
|
|
|
|
|
|
categoryDropdown.Current.BindValueChanged(_ => UpdateFilter());
|
|
|
|
|
|
|
|
return base.CreateFilterControls().Append(categoryDropdown);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override FilterCriteria CreateFilterCriteria()
|
|
|
|
{
|
|
|
|
var criteria = base.CreateFilterCriteria();
|
|
|
|
|
|
|
|
switch (categoryDropdown.Current.Value)
|
|
|
|
{
|
|
|
|
case PlaylistsCategory.Normal:
|
2021-08-13 04:07:02 +00:00
|
|
|
criteria.Category = @"normal";
|
2021-08-12 10:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PlaylistsCategory.Spotlight:
|
2021-08-13 04:07:02 +00:00
|
|
|
criteria.Category = @"spotlight";
|
2021-08-12 10:48:15 +00:00
|
|
|
break;
|
2022-05-27 11:18:46 +00:00
|
|
|
|
|
|
|
case PlaylistsCategory.FeaturedArtist:
|
|
|
|
criteria.Category = @"featured_artist";
|
|
|
|
break;
|
2021-08-12 10:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return criteria;
|
|
|
|
}
|
2020-12-20 15:21:30 +00:00
|
|
|
|
2021-07-14 09:55:01 +00:00
|
|
|
protected override OsuButton CreateNewRoomButton() => new CreatePlaylistsRoomButton();
|
|
|
|
|
|
|
|
protected override Room CreateNewRoom()
|
|
|
|
{
|
2021-08-05 10:55:15 +00:00
|
|
|
return new Room
|
|
|
|
{
|
|
|
|
Name = { Value = $"{api.LocalUser}'s awesome playlist" },
|
|
|
|
Type = { Value = MatchType.Playlists }
|
|
|
|
};
|
2021-07-14 09:55:01 +00:00
|
|
|
}
|
|
|
|
|
2020-12-25 04:11:21 +00:00
|
|
|
protected override RoomSubScreen CreateRoomSubScreen(Room room) => new PlaylistsRoomSubScreen(room);
|
2021-08-12 10:48:15 +00:00
|
|
|
|
2021-08-13 08:39:09 +00:00
|
|
|
protected override ListingPollingComponent CreatePollingComponent() => new ListingPollingComponent();
|
|
|
|
|
2021-08-12 10:48:15 +00:00
|
|
|
private enum PlaylistsCategory
|
|
|
|
{
|
|
|
|
Any,
|
|
|
|
Normal,
|
2022-05-27 11:18:46 +00:00
|
|
|
Spotlight,
|
|
|
|
|
|
|
|
[Description("Featured Artist")]
|
|
|
|
FeaturedArtist,
|
2021-08-12 10:48:15 +00:00
|
|
|
}
|
2020-12-20 14:36:56 +00:00
|
|
|
}
|
|
|
|
}
|