mirror of
https://github.com/osukey/osukey.git
synced 2025-06-23 20:27:58 +09:00
Add playlist count pill
This commit is contained in:
parent
185e36bf97
commit
a8cbffa57e
39
osu.Game/Screens/OnlinePlay/Components/PlaylistCountPill.cs
Normal file
39
osu.Game/Screens/OnlinePlay/Components/PlaylistCountPill.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// 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.Collections.Specialized;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.OnlinePlay.Components
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A pill that displays the playlist item count.
|
||||||
|
/// </summary>
|
||||||
|
public class PlaylistCountPill : RoomInfoPill
|
||||||
|
{
|
||||||
|
private OsuTextFlowContainer count;
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Playlist.BindCollectionChanged(updateCount, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCount(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
count.Clear();
|
||||||
|
count.AddText(Playlist.Count.ToString(), s => s.Font = s.Font.With(weight: FontWeight.Bold));
|
||||||
|
count.AddText(" Maps");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateContent() => count = new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 12))
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -168,7 +168,25 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
},
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new RoomStatusInfo(),
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(4),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new RoomStatusPill
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft
|
||||||
|
},
|
||||||
|
new EndDateInfo
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
new RoomName
|
new RoomName
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -184,7 +202,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
Spacing = new Vector2(4),
|
Spacing = new Vector2(4),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new PlaylistInfoPill
|
new PlaylistCountPill
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user