mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Clear messages when the current channel is removed.
- Stop using TabContainer.Children
This commit is contained in:
parent
381c709639
commit
4f7ae1ed8b
@ -82,12 +82,12 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
private void onTabClose(TabItem<Channel> tab)
|
||||
{
|
||||
int totalTabs = TabContainer.Children.Count - 1; // account for selectorTab
|
||||
int totalTabs = TabContainer.Count - 1; // account for selectorTab
|
||||
int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);
|
||||
|
||||
if (tab == SelectedTab && totalTabs > 1)
|
||||
// Select the tab after tab-to-be-removed's index, or the tab before if current == last
|
||||
SelectTab(TabContainer.Children[currentIndex == totalTabs ? currentIndex - 1 : currentIndex + 1]);
|
||||
SelectTab(TabContainer[currentIndex == totalTabs ? currentIndex - 1 : currentIndex + 1]);
|
||||
else if (totalTabs == 1 && !selectorTab.Active)
|
||||
// Open channel selection overlay if all channel tabs will be closed after removing this tab
|
||||
SelectTab(selectorTab);
|
||||
|
@ -397,7 +397,11 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
if (channel == null) return;
|
||||
|
||||
if (channel == CurrentChannel)
|
||||
currentChannelContainer.Clear(false);
|
||||
|
||||
careChannels.Remove(channel);
|
||||
loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel));
|
||||
channelTabs.RemoveItem(channel);
|
||||
|
||||
channel.Joined.Value = false;
|
||||
|
Loading…
Reference in New Issue
Block a user