mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
Allow traversing in both directions using ctrl-tab shortcuts
This commit is contained in:
parent
a92089c443
commit
49ab031e75
@ -215,8 +215,12 @@ namespace osu.Game.Overlays
|
|||||||
channelManager.JoinLastClosedChannel();
|
channelManager.JoinLastClosedChannel();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case PlatformAction.DocumentPrevious:
|
||||||
|
cycleChannel(-1);
|
||||||
|
return true;
|
||||||
|
|
||||||
case PlatformAction.DocumentNext:
|
case PlatformAction.DocumentNext:
|
||||||
cycleChannel();
|
cycleChannel(1);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -372,7 +376,6 @@ namespace osu.Game.Overlays
|
|||||||
private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
||||||
=> channelListing.UpdateAvailableChannels(channelManager.AvailableChannels);
|
=> channelListing.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||||
|
|
||||||
|
|
||||||
private void handleChatMessage(string message)
|
private void handleChatMessage(string message)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(message))
|
if (string.IsNullOrWhiteSpace(message))
|
||||||
@ -384,21 +387,16 @@ namespace osu.Game.Overlays
|
|||||||
channelManager.PostMessage(message);
|
channelManager.PostMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cycleChannel()
|
private void cycleChannel(int direction)
|
||||||
{
|
{
|
||||||
List<Channel> overlayChannels = filterChannels(channelManager.JoinedChannels).ToList();
|
List<Channel> overlayChannels = filterToChatChannels(channelManager.JoinedChannels).ToList();
|
||||||
|
|
||||||
if (overlayChannels.Count < 2)
|
if (overlayChannels.Count < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int currentIdx = overlayChannels.IndexOf(currentChannel.Value);
|
int currentIndex = overlayChannels.IndexOf(currentChannel.Value);
|
||||||
int nextIdx = currentIdx + 1;
|
|
||||||
|
|
||||||
// Cycle the list when reaching the end
|
currentChannel.Value = overlayChannels[(currentIndex + direction + overlayChannels.Count) % overlayChannels.Count];
|
||||||
if (nextIdx > overlayChannels.Count - 1)
|
|
||||||
nextIdx = 0;
|
|
||||||
|
|
||||||
currentChannel.Value = overlayChannels[nextIdx];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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.System);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user