Merge pull request #18437 from peppy/fa-playlist-category

Add featured artist playlist category
This commit is contained in:
Dean Herbert
2022-05-28 01:28:21 +09:00
committed by GitHub
8 changed files with 59 additions and 10 deletions

View File

@ -30,8 +30,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
{
status.BindValueChanged(s =>
{
this.FadeColour(category.Value == RoomCategory.Spotlight ? colours.Pink : s.NewValue.GetAppropriateColour(colours)
, transitionDuration);
this.FadeColour(colours.ForRoomCategory(category.Value) ?? s.NewValue.GetAppropriateColour(colours), transitionDuration);
}, true);
}
}

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

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
@ -13,6 +14,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
public class RoomSpecialCategoryPill : OnlinePlayComposite
{
private SpriteText text;
private PillContainer pill;
[Resolved]
private OsuColour colours { get; set; }
public RoomSpecialCategoryPill()
{
@ -20,9 +25,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
InternalChild = new PillContainer
InternalChild = pill = new PillContainer
{
Background =
{
@ -43,7 +48,14 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
base.LoadComplete();
Category.BindValueChanged(c => text.Text = c.NewValue.ToString(), true);
Category.BindValueChanged(c =>
{
text.Text = c.NewValue.GetLocalisableDescription();
var backgroundColour = colours.ForRoomCategory(Category.Value);
if (backgroundColour != null)
pill.Background.Colour = backgroundColour.Value;
}, true);
}
}
}

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,
}
}
}