Add featured artist playlist category

This commit is contained in:
Dean Herbert 2022-05-27 20:18:46 +09:00
parent 5657cb757d
commit ef47b380c6
5 changed files with 22 additions and 3 deletions

View File

@ -124,6 +124,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
Status = { Value = new RoomStatusOpen() },
Category = { Value = RoomCategory.Spotlight },
}),
createLoungeRoom(new Room
{
Name = { Value = "Featured artist room" },
Status = { Value = new RoomStatusOpen() },
Category = { Value = RoomCategory.FeaturedArtist },
}),
}
};
});

View File

@ -1,6 +1,8 @@
// 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.
using System.ComponentModel;
namespace osu.Game.Online.Rooms
{
public enum RoomCategory
@ -8,5 +10,8 @@ namespace osu.Game.Online.Rooms
// used for osu-web deserialization so names shouldn't be changed.
Normal,
Spotlight,
[Description("Featured Artist")]
FeaturedArtist,
}
}

View File

@ -237,7 +237,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
roomCategory.BindTo(Room.Category);
roomCategory.BindValueChanged(c =>
{
if (c.NewValue == RoomCategory.Spotlight)
if (c.NewValue > RoomCategory.Normal)
specialCategoryPill.Show();
else
specialCategoryPill.Hide();

View File

@ -128,7 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
foreach (var room in roomFlow)
{
roomFlow.SetLayoutPosition(room, room.Room.Category.Value == RoomCategory.Spotlight
roomFlow.SetLayoutPosition(room, room.Room.Category.Value > RoomCategory.Normal
// Always show spotlight playlists at the top of the listing.
? float.MinValue
: -(room.Room.RoomID.Value ?? 0));

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -49,6 +50,10 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
case PlaylistsCategory.Spotlight:
criteria.Category = @"spotlight";
break;
case PlaylistsCategory.FeaturedArtist:
criteria.Category = @"featured_artist";
break;
}
return criteria;
@ -73,7 +78,10 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
{
Any,
Normal,
Spotlight
Spotlight,
[Description("Featured Artist")]
FeaturedArtist,
}
}
}