mirror of
https://github.com/osukey/osukey.git
synced 2025-06-01 02:47:31 +09:00
Merge pull request #18437 from peppy/fa-playlist-category
Add featured artist playlist category
This commit is contained in:
commit
03d9ca0d8d
@ -124,13 +124,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Status = { Value = new RoomStatusOpen() },
|
Status = { Value = new RoomStatusOpen() },
|
||||||
Category = { Value = RoomCategory.Spotlight },
|
Category = { Value = RoomCategory.Spotlight },
|
||||||
}),
|
}),
|
||||||
|
createLoungeRoom(new Room
|
||||||
|
{
|
||||||
|
Name = { Value = "Featured artist room" },
|
||||||
|
Status = { Value = new RoomStatusOpen() },
|
||||||
|
Category = { Value = RoomCategory.FeaturedArtist },
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for panel load", () => rooms.Count == 5);
|
AddUntilStep("wait for panel load", () => rooms.Count == 6);
|
||||||
AddUntilStep("correct status text", () => rooms.ChildrenOfType<OsuSpriteText>().Count(s => s.Text.ToString().StartsWith("Currently playing", StringComparison.Ordinal)) == 2);
|
AddUntilStep("correct status text", () => rooms.ChildrenOfType<OsuSpriteText>().Count(s => s.Text.ToString().StartsWith("Currently playing", StringComparison.Ordinal)) == 2);
|
||||||
AddUntilStep("correct status text", () => rooms.ChildrenOfType<OsuSpriteText>().Count(s => s.Text.ToString().StartsWith("Ready to play", StringComparison.Ordinal)) == 3);
|
AddUntilStep("correct status text", () => rooms.ChildrenOfType<OsuSpriteText>().Count(s => s.Text.ToString().StartsWith("Ready to play", StringComparison.Ordinal)) == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -188,6 +189,24 @@ namespace osu.Game.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the main accent colour for a <see cref="RoomCategory"/>.
|
||||||
|
/// </summary>
|
||||||
|
public Color4? ForRoomCategory(RoomCategory roomCategory)
|
||||||
|
{
|
||||||
|
switch (roomCategory)
|
||||||
|
{
|
||||||
|
case RoomCategory.Spotlight:
|
||||||
|
return Green2;
|
||||||
|
|
||||||
|
case RoomCategory.FeaturedArtist:
|
||||||
|
return Blue2;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a foreground text colour that is supposed to contrast well with
|
/// Returns a foreground text colour that is supposed to contrast well with
|
||||||
/// the supplied <paramref name="backgroundColour"/>.
|
/// the supplied <paramref name="backgroundColour"/>.
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms
|
namespace osu.Game.Online.Rooms
|
||||||
{
|
{
|
||||||
public enum RoomCategory
|
public enum RoomCategory
|
||||||
@ -8,5 +10,8 @@ namespace osu.Game.Online.Rooms
|
|||||||
// used for osu-web deserialization so names shouldn't be changed.
|
// used for osu-web deserialization so names shouldn't be changed.
|
||||||
Normal,
|
Normal,
|
||||||
Spotlight,
|
Spotlight,
|
||||||
|
|
||||||
|
[Description("Featured Artist")]
|
||||||
|
FeaturedArtist,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
{
|
{
|
||||||
status.BindValueChanged(s =>
|
status.BindValueChanged(s =>
|
||||||
{
|
{
|
||||||
this.FadeColour(category.Value == RoomCategory.Spotlight ? colours.Pink : s.NewValue.GetAppropriateColour(colours)
|
this.FadeColour(colours.ForRoomCategory(category.Value) ?? s.NewValue.GetAppropriateColour(colours), transitionDuration);
|
||||||
, transitionDuration);
|
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
roomCategory.BindTo(Room.Category);
|
roomCategory.BindTo(Room.Category);
|
||||||
roomCategory.BindValueChanged(c =>
|
roomCategory.BindValueChanged(c =>
|
||||||
{
|
{
|
||||||
if (c.NewValue == RoomCategory.Spotlight)
|
if (c.NewValue > RoomCategory.Normal)
|
||||||
specialCategoryPill.Show();
|
specialCategoryPill.Show();
|
||||||
else
|
else
|
||||||
specialCategoryPill.Hide();
|
specialCategoryPill.Hide();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -13,6 +14,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
public class RoomSpecialCategoryPill : OnlinePlayComposite
|
public class RoomSpecialCategoryPill : OnlinePlayComposite
|
||||||
{
|
{
|
||||||
private SpriteText text;
|
private SpriteText text;
|
||||||
|
private PillContainer pill;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
public RoomSpecialCategoryPill()
|
public RoomSpecialCategoryPill()
|
||||||
{
|
{
|
||||||
@ -20,9 +25,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load()
|
||||||
{
|
{
|
||||||
InternalChild = new PillContainer
|
InternalChild = pill = new PillContainer
|
||||||
{
|
{
|
||||||
Background =
|
Background =
|
||||||
{
|
{
|
||||||
@ -43,7 +48,14 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
{
|
{
|
||||||
foreach (var room in roomFlow)
|
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.
|
// Always show spotlight playlists at the top of the listing.
|
||||||
? float.MinValue
|
? float.MinValue
|
||||||
: -(room.Room.RoomID.Value ?? 0));
|
: -(room.Room.RoomID.Value ?? 0));
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -49,6 +50,10 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
case PlaylistsCategory.Spotlight:
|
case PlaylistsCategory.Spotlight:
|
||||||
criteria.Category = @"spotlight";
|
criteria.Category = @"spotlight";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PlaylistsCategory.FeaturedArtist:
|
||||||
|
criteria.Category = @"featured_artist";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return criteria;
|
return criteria;
|
||||||
@ -73,7 +78,10 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
{
|
{
|
||||||
Any,
|
Any,
|
||||||
Normal,
|
Normal,
|
||||||
Spotlight
|
Spotlight,
|
||||||
|
|
||||||
|
[Description("Featured Artist")]
|
||||||
|
FeaturedArtist,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user