Check against type instead of channel name

This commit is contained in:
Paul Teng 2019-05-12 06:11:16 -04:00
parent 496a9dd41d
commit d53fb9a5c8
3 changed files with 5 additions and 6 deletions

View File

@ -93,7 +93,7 @@ namespace osu.Game.Tests.Visual.Online
AddUntilStep("remove all channels", () => AddUntilStep("remove all channels", () =>
{ {
var first = channelTabControl.Items.First(); var first = channelTabControl.Items.First();
if (first.Name == "+") if (first is ChannelSelectorTabChannel)
return true; return true;
channelTabControl.RemoveChannel(first); channelTabControl.RemoveChannel(first);

View File

@ -10,6 +10,7 @@ using osu.Framework.Bindables;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Chat.Tabs;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Online.Chat namespace osu.Game.Online.Chat
@ -86,7 +87,7 @@ namespace osu.Game.Online.Chat
private void currentChannelChanged(ValueChangedEvent<Channel> e) private void currentChannelChanged(ValueChangedEvent<Channel> e)
{ {
if (e.NewValue?.Name != "+") if (!(e.NewValue is ChannelSelectorTabChannel))
JoinChannel(e.NewValue); JoinChannel(e.NewValue);
} }

View File

@ -199,10 +199,8 @@ namespace osu.Game.Overlays
return; return;
} }
if (e.NewValue.Name == "+") if (e.NewValue is ChannelSelectorTabChannel)
{
return; return;
}
textbox.Current.Disabled = e.NewValue.ReadOnly; textbox.Current.Disabled = e.NewValue.ReadOnly;
@ -273,7 +271,7 @@ namespace osu.Game.Overlays
private void selectTab(int index) private void selectTab(int index)
{ {
var channel = channelTabControl.Items.Skip(index).FirstOrDefault(); var channel = channelTabControl.Items.Skip(index).FirstOrDefault();
if (channel != null && channel.Name != "+") if (channel != null && !(channel is ChannelSelectorTabChannel))
channelTabControl.Current.Value = channel; channelTabControl.Current.Value = channel;
} }