mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 14:22:55 +08:00
Merge pull request #786 from Jorolf/channel-selector-tab-item
Add an "Add new channel" tab
This commit is contained in:
commit
03ac700838
@ -14,6 +14,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Chat
|
namespace osu.Game.Overlays.Chat
|
||||||
{
|
{
|
||||||
@ -23,6 +24,8 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
private const float shear_width = 10;
|
private const float shear_width = 10;
|
||||||
|
|
||||||
|
public readonly Bindable<bool> ChannelSelectorActive = new Bindable<bool>();
|
||||||
|
|
||||||
public ChatTabControl()
|
public ChatTabControl()
|
||||||
{
|
{
|
||||||
TabContainer.Margin = new MarginPadding { Left = 50 };
|
TabContainer.Margin = new MarginPadding { Left = 50 };
|
||||||
@ -37,6 +40,8 @@ namespace osu.Game.Overlays.Chat
|
|||||||
TextSize = 20,
|
TextSize = 20,
|
||||||
Padding = new MarginPadding(10),
|
Padding = new MarginPadding(10),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(new Channel { Name = "+" }, ChannelSelectorActive));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChannelTabItem : TabItem<Channel>
|
private class ChannelTabItem : TabItem<Channel>
|
||||||
@ -49,6 +54,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
private readonly SpriteText textBold;
|
private readonly SpriteText textBold;
|
||||||
private readonly Box box;
|
private readonly Box box;
|
||||||
private readonly Box highlightBox;
|
private readonly Box highlightBox;
|
||||||
|
private readonly TextAwesome icon;
|
||||||
|
|
||||||
public override bool Active
|
public override bool Active
|
||||||
{
|
{
|
||||||
@ -114,6 +120,11 @@ namespace osu.Game.Overlays.Chat
|
|||||||
backgroundHover = colours.Gray7;
|
backgroundHover = colours.Gray7;
|
||||||
|
|
||||||
highlightBox.Colour = colours.Yellow;
|
highlightBox.Colour = colours.Yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
@ -159,7 +170,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new TextAwesome
|
icon = new TextAwesome
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_hashtag,
|
Icon = FontAwesome.fa_hashtag,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -191,6 +202,40 @@ namespace osu.Game.Overlays.Chat
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ChannelSelectorTabItem : ChannelTabItem
|
||||||
|
{
|
||||||
|
public override bool Active
|
||||||
|
{
|
||||||
|
get { return base.Active; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
activeBindable.Value = value;
|
||||||
|
base.Active = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly Bindable<bool> activeBindable;
|
||||||
|
|
||||||
|
public ChannelSelectorTabItem(Channel value, Bindable<bool> active) : base(value)
|
||||||
|
{
|
||||||
|
activeBindable = active;
|
||||||
|
Depth = float.MaxValue;
|
||||||
|
Width = 45;
|
||||||
|
|
||||||
|
icon.Alpha = 0;
|
||||||
|
|
||||||
|
text.TextSize = 45;
|
||||||
|
textBold.TextSize = 45;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private new void load(OsuColour colour)
|
||||||
|
{
|
||||||
|
backgroundInactive = colour.Gray2;
|
||||||
|
backgroundActive = colour.Gray3;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,6 +260,8 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
if (currentChannel == value) return;
|
if (currentChannel == value) return;
|
||||||
|
|
||||||
|
if (channelTabs.ChannelSelectorActive) return;
|
||||||
|
|
||||||
if (currentChannel != null)
|
if (currentChannel != null)
|
||||||
currentChannelContainer.Clear(false);
|
currentChannelContainer.Clear(false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user