2020-12-20 22:36:56 +08: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 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2021-08-12 18:48:15 +08:00
|
|
|
using System.Collections.Generic;
|
2022-05-27 19:18:46 +08:00
|
|
|
using System.ComponentModel;
|
2021-08-12 18:48:15 +08:00
|
|
|
using System.Linq;
|
2021-07-14 17:55:01 +08:00
|
|
|
using osu.Framework.Allocation;
|
2021-08-12 18:48:15 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2021-07-14 17:55:01 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
using osu.Game.Online.API;
|
2020-12-25 12:38:11 +08:00
|
|
|
using osu.Game.Online.Rooms;
|
2021-08-13 16:39:09 +08:00
|
|
|
using osu.Game.Screens.OnlinePlay.Components;
|
2020-12-25 23:50:00 +08:00
|
|
|
using osu.Game.Screens.OnlinePlay.Lounge;
|
|
|
|
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
|
|
|
using osu.Game.Screens.OnlinePlay.Match;
|
2020-12-20 22:36:56 +08:00
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Playlists
|
2020-12-20 22:36:56 +08:00
|
|
|
{
|
2020-12-25 12:11:21 +08:00
|
|
|
public class PlaylistsLoungeSubScreen : LoungeSubScreen
|
2020-12-20 22:36:56 +08:00
|
|
|
{
|
2021-07-14 17:55:01 +08:00
|
|
|
[Resolved]
|
|
|
|
private IAPIProvider api { get; set; }
|
|
|
|
|
2021-08-12 18:48:15 +08: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 12:07:02 +08:00
|
|
|
criteria.Category = @"normal";
|
2021-08-12 18:48:15 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PlaylistsCategory.Spotlight:
|
2021-08-13 12:07:02 +08:00
|
|
|
criteria.Category = @"spotlight";
|
2021-08-12 18:48:15 +08:00
|
|
|
break;
|
2022-05-27 19:18:46 +08:00
|
|
|
|
|
|
|
case PlaylistsCategory.FeaturedArtist:
|
|
|
|
criteria.Category = @"featured_artist";
|
|
|
|
break;
|
2021-08-12 18:48:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return criteria;
|
|
|
|
}
|
2020-12-20 23:21:30 +08:00
|
|
|
|
2021-07-14 17:55:01 +08:00
|
|
|
protected override OsuButton CreateNewRoomButton() => new CreatePlaylistsRoomButton();
|
|
|
|
|
|
|
|
protected override Room CreateNewRoom()
|
|
|
|
{
|
2021-08-05 18:55:15 +08:00
|
|
|
return new Room
|
|
|
|
{
|
|
|
|
Name = { Value = $"{api.LocalUser}'s awesome playlist" },
|
|
|
|
Type = { Value = MatchType.Playlists }
|
|
|
|
};
|
2021-07-14 17:55:01 +08:00
|
|
|
}
|
|
|
|
|
2020-12-25 12:11:21 +08:00
|
|
|
protected override RoomSubScreen CreateRoomSubScreen(Room room) => new PlaylistsRoomSubScreen(room);
|
2021-08-12 18:48:15 +08:00
|
|
|
|
2021-08-13 16:39:09 +08:00
|
|
|
protected override ListingPollingComponent CreatePollingComponent() => new ListingPollingComponent();
|
|
|
|
|
2021-08-12 18:48:15 +08:00
|
|
|
private enum PlaylistsCategory
|
|
|
|
{
|
|
|
|
Any,
|
|
|
|
Normal,
|
2022-05-27 19:18:46 +08:00
|
|
|
Spotlight,
|
|
|
|
|
|
|
|
[Description("Featured Artist")]
|
|
|
|
FeaturedArtist,
|
2021-08-12 18:48:15 +08:00
|
|
|
}
|
2020-12-20 22:36:56 +08:00
|
|
|
}
|
|
|
|
}
|