mirror of https://github.com/ppy/osu
Ensure current channel is set to the `ChannelListingChannel` when it becomes `null`
This commit is contained in:
parent
136ecb45e2
commit
c37d1e4fae
|
@ -22,9 +22,9 @@ public class ChannelList : Container
|
|||
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 @@ private void load(OverlayColourProvider colourProvider)
|
|||
Children = new Drawable[]
|
||||
{
|
||||
publicChannelFlow = new ChannelListItemFlow("CHANNELS"),
|
||||
selector = new ChannelListItem(channelListingChannel)
|
||||
selector = new ChannelListItem(ChannelListingChannel)
|
||||
{
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
},
|
||||
|
|
|
@ -179,7 +179,7 @@ protected override void OnHoverLost(HoverLostEvent e)
|
|||
|
||||
private void updateState()
|
||||
{
|
||||
bool selected = selectedChannel.Value == Channel || (isSelector && selectedChannel.Value == null);
|
||||
bool selected = selectedChannel.Value == Channel;
|
||||
|
||||
if (selected)
|
||||
selectBox.FadeIn(300, Easing.OutQuint);
|
||||
|
|
|
@ -244,9 +244,15 @@ private void currentChannelChanged(ValueChangedEvent<Channel> channel)
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue