Add back support for new API and private messages

This commit is contained in:
Dean Herbert
2018-11-13 15:20:40 +09:00
parent 8b9f7f6691
commit f241fcdba1
9 changed files with 135 additions and 234 deletions

View File

@ -153,7 +153,7 @@ namespace osu.Game.Overlays
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
OnRequestLeave = channel => channelManager.JoinedChannels.Remove(channel)
OnRequestLeave = channel => channelManager.LeaveChannel(channel)
},
}
},
@ -176,15 +176,9 @@ namespace osu.Game.Overlays
else
textbox.HoldFocus = true;
};
channelSelection.OnRequestJoin = channel =>
{
if (!channelManager.JoinedChannels.Contains(channel))
{
channelManager.JoinedChannels.Add(channel);
channelManager.FetchInitalMessages(channel);
}
};
channelSelection.OnRequestLeave = channel => channelManager.JoinedChannels.Remove(channel);
channelSelection.OnRequestJoin = channel => channelManager.JoinChannel(channel);
channelSelection.OnRequestLeave = channel => channelManager.LeaveChannel(channel);
}
private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
@ -195,18 +189,16 @@ namespace osu.Game.Overlays
foreach (Channel newChannel in args.NewItems)
{
channelTabControl.AddChannel(newChannel);
newChannel.Joined.Value = true;
}
break;
case NotifyCollectionChangedAction.Remove:
foreach (Channel removedChannel in args.OldItems)
{
channelTabControl.RemoveChannel(removedChannel);
loadedChannels.Remove(loadedChannels.Find(c => c.Channel == removedChannel ));
removedChannel.Joined.Value = false;
loadedChannels.Remove(loadedChannels.Find(c => c.Channel == removedChannel));
}
break;
}
}