1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Merge branch 'master' into autopilot

This commit is contained in:
RedMindZ 2019-05-12 16:27:31 +03:00 committed by GitHub
commit a3daefe668
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 6 deletions

View File

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

View File

@ -10,6 +10,7 @@ using osu.Framework.Bindables;
using osu.Framework.Logging;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Chat.Tabs;
using osu.Game.Users;
namespace osu.Game.Online.Chat
@ -84,7 +85,11 @@ namespace osu.Game.Online.Chat
?? new Channel(user);
}
private void currentChannelChanged(ValueChangedEvent<Channel> e) => JoinChannel(e.NewValue);
private void currentChannelChanged(ValueChangedEvent<Channel> e)
{
if (!(e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel))
JoinChannel(e.NewValue);
}
/// <summary>
/// Ensure we run post actions in sequence, once at a time.

View File

@ -13,8 +13,8 @@ namespace osu.Game.Overlays.Chat.Tabs
public override bool IsSwitchable => false;
public ChannelSelectorTabItem(Channel value)
: base(value)
public ChannelSelectorTabItem()
: base(new ChannelSelectorTabChannel())
{
Depth = float.MaxValue;
Width = 45;
@ -31,5 +31,13 @@ namespace osu.Game.Overlays.Chat.Tabs
BackgroundInactive = colour.Gray2;
BackgroundActive = colour.Gray3;
}
public class ChannelSelectorTabChannel : Channel
{
public ChannelSelectorTabChannel()
{
Name = "+";
}
}
}
}

View File

@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Chat.Tabs
Margin = new MarginPadding(10),
});
AddTabItem(selectorTab = new ChannelSelectorTabItem(new Channel { Name = "+" }));
AddTabItem(selectorTab = new ChannelSelectorTabItem());
ChannelSelectorActive.BindTo(selectorTab.Active);
}

View File

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