mirror of
https://github.com/osukey/osukey.git
synced 2025-06-30 07:38:04 +09: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)
|
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);
|
int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);
|
||||||
|
|
||||||
if (tab == SelectedTab && totalTabs > 1)
|
if (tab == SelectedTab && totalTabs > 1)
|
||||||
// Select the tab after tab-to-be-removed's index, or the tab before if current == last
|
// 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)
|
else if (totalTabs == 1 && !selectorTab.Active)
|
||||||
// Open channel selection overlay if all channel tabs will be closed after removing this tab
|
// Open channel selection overlay if all channel tabs will be closed after removing this tab
|
||||||
SelectTab(selectorTab);
|
SelectTab(selectorTab);
|
||||||
|
@ -397,7 +397,11 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
if (channel == null) return;
|
if (channel == null) return;
|
||||||
|
|
||||||
|
if (channel == CurrentChannel)
|
||||||
|
currentChannelContainer.Clear(false);
|
||||||
|
|
||||||
careChannels.Remove(channel);
|
careChannels.Remove(channel);
|
||||||
|
loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel));
|
||||||
channelTabs.RemoveItem(channel);
|
channelTabs.RemoveItem(channel);
|
||||||
|
|
||||||
channel.Joined.Value = false;
|
channel.Joined.Value = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user