1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 10:33:01 +08:00

Fix oversight in bindable logic in new overlay class

This commit is contained in:
Dean Herbert 2022-05-19 19:24:18 +09:00
parent dd4b11c593
commit 63c9776365

View File

@ -62,6 +62,9 @@ namespace osu.Game.Overlays
[Cached] [Cached]
private readonly Bindable<Channel> currentChannel = new Bindable<Channel>(); private readonly Bindable<Channel> currentChannel = new Bindable<Channel>();
private readonly IBindableList<Channel> availableChannels = new BindableList<Channel>();
private readonly IBindableList<Channel> joinedChannels = new BindableList<Channel>();
public ChatOverlayV2() public ChatOverlayV2()
{ {
Height = default_chat_height; Height = default_chat_height;
@ -147,9 +150,13 @@ namespace osu.Game.Overlays
chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true); chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true);
currentChannel.BindTo(channelManager.CurrentChannel); currentChannel.BindTo(channelManager.CurrentChannel);
channelManager.CurrentChannel.BindValueChanged(currentChannelChanged, true); currentChannel.BindValueChanged(currentChannelChanged, true);
channelManager.JoinedChannels.BindCollectionChanged(joinedChannelsChanged, true);
channelManager.AvailableChannels.BindCollectionChanged(availableChannelsChanged, true); joinedChannels.BindTo(channelManager.JoinedChannels);
joinedChannels.BindCollectionChanged(joinedChannelsChanged, true);
availableChannels.BindTo(channelManager.AvailableChannels);
availableChannels.BindCollectionChanged(availableChannelsChanged, true);
channelList.OnRequestSelect += channel => channelManager.CurrentChannel.Value = channel; channelList.OnRequestSelect += channel => channelManager.CurrentChannel.Value = channel;
channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel); channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel);
@ -263,8 +270,8 @@ namespace osu.Game.Overlays
switch (args.Action) switch (args.Action)
{ {
case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Add:
IEnumerable<Channel> joinedChannels = filterChannels(args.NewItems); IEnumerable<Channel> newChannels = filterChannels(args.NewItems);
foreach (var channel in joinedChannels) foreach (var channel in newChannels)
channelList.AddChannel(channel); channelList.AddChannel(channel);
break; break;