From ef47b380c602095a3d635017adb106b294f21e54 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 20:18:46 +0900 Subject: [PATCH 1/4] Add featured artist playlist category --- .../Visual/Multiplayer/TestSceneDrawableRoom.cs | 6 ++++++ osu.Game/Online/Rooms/RoomCategory.cs | 5 +++++ .../OnlinePlay/Lounge/Components/DrawableRoom.cs | 2 +- .../OnlinePlay/Lounge/Components/RoomsContainer.cs | 2 +- .../OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs | 10 +++++++++- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs index 7d010592ae..7c1620a345 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs @@ -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 }, + }), } }; }); diff --git a/osu.Game/Online/Rooms/RoomCategory.cs b/osu.Game/Online/Rooms/RoomCategory.cs index a1dcfa5fd9..bca4d78359 100644 --- a/osu.Game/Online/Rooms/RoomCategory.cs +++ b/osu.Game/Online/Rooms/RoomCategory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . 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, } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs index 8e3aa77e7b..772232f6b4 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs @@ -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(); diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index d61fbea387..0fd9290880 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -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)); diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs index dced9b8691..b36e162e3d 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs @@ -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, } } } From 883c6f1eb30f460790d4d74fbe16e96f08e866e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 20:19:03 +0900 Subject: [PATCH 2/4] Update colour of spotlights playlist to match new specs --- .../Components/RoomSpecialCategoryPill.cs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs index 6cdbeb2af4..00e4fbf5eb 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs @@ -2,10 +2,12 @@ // 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; using osu.Game.Graphics.Sprites; +using osu.Game.Online.Rooms; using osuTK.Graphics; namespace osu.Game.Screens.OnlinePlay.Lounge.Components @@ -13,6 +15,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 +26,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 +49,21 @@ 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(); + + switch (c.NewValue) + { + case RoomCategory.Spotlight: + pill.Background.Colour = colours.Green2; + break; + + case RoomCategory.FeaturedArtist: + pill.Background.Colour = colours.Blue2; + break; + } + }, true); } } } From 2f57849bcba348d5eeb24c731d30234d465cab1a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 20:58:13 +0900 Subject: [PATCH 3/4] Fix unexpected assertion failure --- osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs index 7c1620a345..3172a68b81 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs @@ -134,9 +134,9 @@ namespace osu.Game.Tests.Visual.Multiplayer }; }); - AddUntilStep("wait for panel load", () => rooms.Count == 5); + AddUntilStep("wait for panel load", () => rooms.Count == 6); AddUntilStep("correct status text", () => rooms.ChildrenOfType().Count(s => s.Text.ToString().StartsWith("Currently playing", StringComparison.Ordinal)) == 2); - AddUntilStep("correct status text", () => rooms.ChildrenOfType().Count(s => s.Text.ToString().StartsWith("Ready to play", StringComparison.Ordinal)) == 3); + AddUntilStep("correct status text", () => rooms.ChildrenOfType().Count(s => s.Text.ToString().StartsWith("Ready to play", StringComparison.Ordinal)) == 4); } [Test] From a94432f3bd743ec4c98f8d45a2e095f6f5f85e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 27 May 2022 16:40:15 +0200 Subject: [PATCH 4/4] Fix drawable room border colour not matching badge --- osu.Game/Graphics/OsuColour.cs | 19 +++++++++++++++++++ .../Components/StatusColouredContainer.cs | 3 +-- .../Components/RoomSpecialCategoryPill.cs | 14 +++----------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index afedf36cad..7a6a677940 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Beatmaps; +using osu.Game.Online.Rooms; using osu.Game.Overlays; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; @@ -188,6 +189,24 @@ namespace osu.Game.Graphics } } + /// + /// Retrieves the main accent colour for a . + /// + public Color4? ForRoomCategory(RoomCategory roomCategory) + { + switch (roomCategory) + { + case RoomCategory.Spotlight: + return Green2; + + case RoomCategory.FeaturedArtist: + return Blue2; + + default: + return null; + } + } + /// /// Returns a foreground text colour that is supposed to contrast well with /// the supplied . diff --git a/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs b/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs index 760de354dc..a7ea32ee7c 100644 --- a/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs @@ -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); } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs index 00e4fbf5eb..539af2ebaf 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Online.Rooms; using osuTK.Graphics; namespace osu.Game.Screens.OnlinePlay.Lounge.Components @@ -53,16 +52,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { text.Text = c.NewValue.GetLocalisableDescription(); - switch (c.NewValue) - { - case RoomCategory.Spotlight: - pill.Background.Colour = colours.Green2; - break; - - case RoomCategory.FeaturedArtist: - pill.Background.Colour = colours.Blue2; - break; - } + var backgroundColour = colours.ForRoomCategory(Category.Value); + if (backgroundColour != null) + pill.Background.Colour = backgroundColour.Value; }, true); } }