mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 00:12:55 +08:00
Don't show multiplayer channels in chat overlay
This commit is contained in:
parent
c36b753d62
commit
488374b4a2
@ -393,6 +393,25 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
channelManager.CurrentChannel.Value.Type == ChannelType.PM && channelManager.CurrentChannel.Value.Users.Single().Username == "some body");
|
channelManager.CurrentChannel.Value.Type == ChannelType.PM && channelManager.CurrentChannel.Value.Users.Single().Username == "some body");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMultiplayerChannelIsNotShown()
|
||||||
|
{
|
||||||
|
Channel multiplayerChannel = null;
|
||||||
|
|
||||||
|
AddStep("join multiplayer channel", () => channelManager.JoinChannel(multiplayerChannel = new Channel(new APIUser())
|
||||||
|
{
|
||||||
|
Name = "#mp_1",
|
||||||
|
Type = ChannelType.Multiplayer,
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddAssert("channel joined", () => channelManager.JoinedChannels.Contains(multiplayerChannel));
|
||||||
|
AddAssert("channel not present in overlay", () => !chatOverlay.TabMap.ContainsKey(multiplayerChannel));
|
||||||
|
AddAssert("multiplayer channel is not current", () => channelManager.CurrentChannel.Value != multiplayerChannel);
|
||||||
|
|
||||||
|
AddStep("leave channel", () => channelManager.LeaveChannel(multiplayerChannel));
|
||||||
|
AddAssert("channel left", () => !channelManager.JoinedChannels.Contains(multiplayerChannel));
|
||||||
|
}
|
||||||
|
|
||||||
private void pressChannelHotkey(int number)
|
private void pressChannelHotkey(int number)
|
||||||
{
|
{
|
||||||
var channelKey = Key.Number0 + number;
|
var channelKey = Key.Number0 + number;
|
||||||
|
@ -237,10 +237,7 @@ namespace osu.Game.Overlays
|
|||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
|
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
|
||||||
channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
|
channelManager.JoinedChannels.BindCollectionChanged(joinedChannelsChanged, true);
|
||||||
|
|
||||||
foreach (Channel channel in channelManager.JoinedChannels)
|
|
||||||
ChannelTabControl.AddChannel(channel);
|
|
||||||
|
|
||||||
channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
|
channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
|
||||||
availableChannelsChanged(null, null);
|
availableChannelsChanged(null, null);
|
||||||
@ -436,12 +433,19 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
case NotifyCollectionChangedAction.Add:
|
case NotifyCollectionChangedAction.Add:
|
||||||
foreach (Channel channel in args.NewItems.Cast<Channel>())
|
foreach (Channel channel in args.NewItems.Cast<Channel>())
|
||||||
|
{
|
||||||
|
if (channel.Type != ChannelType.Multiplayer)
|
||||||
ChannelTabControl.AddChannel(channel);
|
ChannelTabControl.AddChannel(channel);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NotifyCollectionChangedAction.Remove:
|
case NotifyCollectionChangedAction.Remove:
|
||||||
foreach (Channel channel in args.OldItems.Cast<Channel>())
|
foreach (Channel channel in args.OldItems.Cast<Channel>())
|
||||||
{
|
{
|
||||||
|
if (!ChannelTabControl.Items.Contains(channel))
|
||||||
|
continue;
|
||||||
|
|
||||||
ChannelTabControl.RemoveChannel(channel);
|
ChannelTabControl.RemoveChannel(channel);
|
||||||
|
|
||||||
var loaded = loadedChannels.Find(c => c.Channel == channel);
|
var loaded = loadedChannels.Find(c => c.Channel == channel);
|
||||||
|
Loading…
Reference in New Issue
Block a user