diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index d1ceae604c..f212f5b162 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -4,6 +4,7 @@ #nullable enable using System; +using System.Linq; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -22,6 +23,8 @@ namespace osu.Game.Overlays.Chat.ChannelList public Action? OnRequestSelect; public Action? OnRequestLeave; + public IEnumerable Channels => publicChannelFlow.Channels.Concat(privateChannelFlow.Channels); + public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel(); private readonly Dictionary channelMap = new Dictionary(); @@ -118,6 +121,10 @@ namespace osu.Game.Overlays.Chat.ChannelList private class ChannelListItemFlow : FillFlowContainer { + public IEnumerable Channels => Children.Where(c => c is ChannelListItem) + .Cast() + .Select(c => c.Channel); + public ChannelListItemFlow(string label) { Direction = FillDirection.Vertical; diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index d0355e0165..cc780073ce 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -389,7 +389,7 @@ namespace osu.Game.Overlays private void cycleChannel(int direction) { - List overlayChannels = filterToChatChannels(channelManager.JoinedChannels).ToList(); + List overlayChannels = channelList.Channels.ToList(); if (overlayChannels.Count < 2) return; @@ -399,6 +399,7 @@ namespace osu.Game.Overlays currentChannel.Value = overlayChannels[(currentIndex + direction + overlayChannels.Count) % overlayChannels.Count]; } - private IEnumerable filterToChatChannels(IEnumerable channels) => channels.Cast().Where(c => c.Type != ChannelType.System); + private IEnumerable filterToChatChannels(IEnumerable channels) + => channels.Cast().Where(c => c.Type == ChannelType.PM || c.Type == ChannelType.Public); } }