Skip to content

Commit

Permalink
Remove selectorActive bindable completely
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed May 12, 2022
1 parent c45e8f6 commit 2dfed6e
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions osu.Game/Overlays/ChatOverlayV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public class ChatOverlayV2 : OsuFocusedOverlayContainer, INamedOverlayComponent
private const float side_bar_width = 190;
private const float chat_bar_height = 60;

private readonly BindableBool selectorActive = new BindableBool();

[Resolved]
private OsuConfigManager config { get; set; } = null!;

Expand Down Expand Up @@ -136,7 +134,6 @@ private void load()
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Padding = new MarginPadding { Left = side_bar_width },
ShowSearch = { BindTarget = selectorActive },
},
};
}
Expand All @@ -145,8 +142,6 @@ protected override void LoadComplete()
{
base.LoadComplete();

loading.Show();

config.BindWith(OsuSetting.ChatDisplayHeight, chatHeight);

chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true);
Expand All @@ -164,8 +159,6 @@ protected override void LoadComplete()

textBar.OnSearchTermsChanged += searchTerms => channelListing.SearchTerm = searchTerms;
textBar.OnChatMessageCommitted += handleChatMessage;

selectorActive.BindValueChanged(v => channelListing.State.Value = v.NewValue ? Visibility.Visible : Visibility.Hidden, true);
}

/// <summary>
Expand Down Expand Up @@ -244,22 +237,25 @@ private void currentChannelChanged(ValueChangedEvent<Channel> channel)
{
Channel? newChannel = channel.NewValue;

loading.Show();

if (newChannel == null)
{
selectorActive.Value = true;
return;
// null channel denotes that we should be showing the listing.
channelListing.State.Value = Visibility.Visible;
textBar.ShowSearch.Value = true;
}

selectorActive.Value = false;

LoadComponentAsync(new DrawableChannel(newChannel), loaded =>
else
{
currentChannelContainer.Clear();
currentChannelContainer.Add(loaded);
loading.Hide();
});
channelListing.State.Value = Visibility.Hidden;
textBar.ShowSearch.Value = false;

loading.Show();
LoadComponentAsync(new DrawableChannel(newChannel), loaded =>
{
currentChannelContainer.Clear();
currentChannelContainer.Add(loaded);
loading.Hide();
});
}
}

private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
Expand Down

0 comments on commit 2dfed6e

Please sign in to comment.