display count of listQueue

This commit is contained in:
hwabis 2022-03-18 01:37:53 -04:00
parent af6d53ad64
commit c2e7ff7e3e

View File

@ -7,6 +7,8 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
@ -29,6 +31,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
private MultiplayerHistoryList historyList; private MultiplayerHistoryList historyList;
private bool firstPopulation = true; private bool firstPopulation = true;
private OsuSpriteText queueListCount;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -42,6 +46,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
Height = tab_control_height, Height = tab_control_height,
Current = { BindTarget = DisplayMode } Current = { BindTarget = DisplayMode }
}, },
queueListCount = new OsuSpriteText
{
Font = OsuFont.Default.With(weight: FontWeight.Bold),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -70,6 +80,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
{ {
base.LoadComplete(); base.LoadComplete();
DisplayMode.BindValueChanged(onDisplayModeChanged, true); DisplayMode.BindValueChanged(onDisplayModeChanged, true);
queueList.Items.BindCollectionChanged(
(_, __) => queueListCount.Text = queueList.Items.Count.ToString(), true);
} }
private void onDisplayModeChanged(ValueChangedEvent<MultiplayerPlaylistDisplayMode> mode) private void onDisplayModeChanged(ValueChangedEvent<MultiplayerPlaylistDisplayMode> mode)