diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylist.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylist.cs index 2b59452ff1..c65ff1bd00 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylist.cs @@ -8,11 +8,8 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; -using osuTK; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist { @@ -32,41 +29,20 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist private MultiplayerHistoryList historyList; private bool firstPopulation = true; - private OsuSpriteText queueListCount; + private MultiplayerPlaylistTabControl playlistTabControl; [BackgroundDependencyLoader] - private void load(OsuColour osuColour) + private void load() { const float tab_control_height = 25; InternalChildren = new Drawable[] { - new FillFlowContainer + playlistTabControl = new MultiplayerPlaylistTabControl { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(OsuTabControl.HORIZONTAL_SPACING, 0), - Children = new Drawable[] - { - queueListCount = new OsuSpriteText - { - Font = OsuFont.Default.With(weight: FontWeight.Bold), - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Colour = osuColour.Yellow, - }, - new OsuTabControl - { - RelativeSizeAxes = Axes.X, - Height = tab_control_height, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Current = { BindTarget = DisplayMode }, - }, - } + Height = tab_control_height, + Current = { BindTarget = DisplayMode }, }, new Container { @@ -97,7 +73,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist base.LoadComplete(); DisplayMode.BindValueChanged(onDisplayModeChanged, true); queueList.Items.BindCollectionChanged( - (_, __) => queueListCount.Text = queueList.Items.Count.ToString(), true); + (_, __) => playlistTabControl.queueListCount = queueList.Items.Count, true); } private void onDisplayModeChanged(ValueChangedEvent mode) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs new file mode 100644 index 0000000000..f6a5bfed41 --- /dev/null +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs @@ -0,0 +1,34 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist +{ + public class MultiplayerPlaylistTabControl : OsuTabControl + { + public int queueListCount; + + public MultiplayerPlaylistTabControl() + { + queueListCount = 0; + } + + protected override TabItem CreateTabItem(MultiplayerPlaylistDisplayMode value) + { + if (value == MultiplayerPlaylistDisplayMode.Queue) + return new QueueTabItem(value, queueListCount); + return new OsuTabItem(value); + } + + private class QueueTabItem : OsuTabItem + { + public QueueTabItem(MultiplayerPlaylistDisplayMode value, int count) + : base(value) + { + Text.Text += " (" + count + ")"; + } + } + } +}