(still not working) try bindables instead of int

This commit is contained in:
hwabis 2022-03-18 20:32:37 -04:00
parent d9b2a29c6d
commit 5e5fbc496e
2 changed files with 9 additions and 5 deletions

View File

@ -73,7 +73,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
base.LoadComplete();
DisplayMode.BindValueChanged(onDisplayModeChanged, true);
queueList.Items.BindCollectionChanged(
(_, __) => playlistTabControl.queueListCount = queueList.Items.Count, true);
(_, __) => playlistTabControl.queueListCount.Value = queueList.Items.Count, true);
}
private void onDisplayModeChanged(ValueChangedEvent<MultiplayerPlaylistDisplayMode> mode)

View File

@ -1,6 +1,7 @@
// 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 osu.Framework.Bindables;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
@ -8,11 +9,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
{
public class MultiplayerPlaylistTabControl : OsuTabControl<MultiplayerPlaylistDisplayMode>
{
public int queueListCount;
public Bindable<int> queueListCount = new Bindable<int>(0);
public MultiplayerPlaylistTabControl()
{
queueListCount = 0;
}
protected override TabItem<MultiplayerPlaylistDisplayMode> CreateTabItem(MultiplayerPlaylistDisplayMode value)
@ -24,10 +24,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
private class QueueTabItem : OsuTabItem
{
public QueueTabItem(MultiplayerPlaylistDisplayMode value, int count)
private Bindable<int> count;
public QueueTabItem(MultiplayerPlaylistDisplayMode value, Bindable<int> queueListCount)
: base(value)
{
Text.Text += " (" + count + ")";
count = new Bindable<int>();
count.BindTo(queueListCount);
Text.Text += " (" + count.Value + ")";
}
}
}