1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +08:00

Ensure current channel is set to the ChannelListingChannel when it becomes null

This commit is contained in:
Jai Sharma 2022-05-19 11:45:39 +01:00
parent 136ecb45e2
commit c37d1e4fae
3 changed files with 12 additions and 6 deletions

View File

@ -22,9 +22,9 @@ namespace osu.Game.Overlays.Chat.ChannelList
public Action<Channel>? OnRequestSelect;
public Action<Channel>? OnRequestLeave;
private readonly Dictionary<Channel, ChannelListItem> channelMap = new Dictionary<Channel, ChannelListItem>();
public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel();
private readonly ChannelListing.ChannelListingChannel channelListingChannel = new ChannelListing.ChannelListingChannel();
private readonly Dictionary<Channel, ChannelListItem> channelMap = new Dictionary<Channel, ChannelListItem>();
private ChannelListItemFlow publicChannelFlow = null!;
private ChannelListItemFlow privateChannelFlow = null!;
@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
Children = new Drawable[]
{
publicChannelFlow = new ChannelListItemFlow("CHANNELS"),
selector = new ChannelListItem(channelListingChannel)
selector = new ChannelListItem(ChannelListingChannel)
{
Margin = new MarginPadding { Bottom = 10 },
},

View File

@ -179,7 +179,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
private void updateState()
{
bool selected = selectedChannel.Value == Channel || (isSelector && selectedChannel.Value == null);
bool selected = selectedChannel.Value == Channel;
if (selected)
selectBox.FadeIn(300, Easing.OutQuint);

View File

@ -244,9 +244,15 @@ namespace osu.Game.Overlays
{
Channel? newChannel = channel.NewValue;
if (newChannel == null || newChannel is ChannelListing.ChannelListingChannel)
// null channel denotes that we should be showing the listing.
if (newChannel == null)
{
currentChannel.Value = channelList.ChannelListingChannel;
return;
}
if (newChannel is ChannelListing.ChannelListingChannel)
{
// null channel denotes that we should be showing the listing.
channelListing.State.Value = Visibility.Visible;
textBar.ShowSearch.Value = true;
}