1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:43:21 +08:00

Ensure channel traversal shortcut is using visual order

This commit is contained in:
Jai Sharma 2022-05-25 12:29:04 +01:00
parent 49ab031e75
commit 4a36f3aa4c
2 changed files with 10 additions and 2 deletions

View File

@ -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<Channel>? OnRequestSelect;
public Action<Channel>? OnRequestLeave;
public IEnumerable<Channel> Channels => publicChannelFlow.Channels.Concat(privateChannelFlow.Channels);
public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel();
private readonly Dictionary<Channel, ChannelListItem> channelMap = new Dictionary<Channel, ChannelListItem>();
@ -118,6 +121,10 @@ namespace osu.Game.Overlays.Chat.ChannelList
private class ChannelListItemFlow : FillFlowContainer
{
public IEnumerable<Channel> Channels => Children.Where(c => c is ChannelListItem)
.Cast<ChannelListItem>()
.Select(c => c.Channel);
public ChannelListItemFlow(string label)
{
Direction = FillDirection.Vertical;

View File

@ -389,7 +389,7 @@ namespace osu.Game.Overlays
private void cycleChannel(int direction)
{
List<Channel> overlayChannels = filterToChatChannels(channelManager.JoinedChannels).ToList();
List<Channel> 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<Channel> filterToChatChannels(IEnumerable channels) => channels.Cast<Channel>().Where(c => c.Type != ChannelType.System);
private IEnumerable<Channel> filterToChatChannels(IEnumerable channels)
=> channels.Cast<Channel>().Where(c => c.Type == ChannelType.PM || c.Type == ChannelType.Public);
}
}