mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:02:55 +08:00
add tab item
This commit is contained in:
parent
78c1d4581f
commit
67806c4247
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Chat
|
||||
{
|
||||
public class ChatTabControl : OsuTabControl<Channel>
|
||||
{
|
||||
protected override TabItem<Channel> CreateTabItem(Channel value) => new ChannelTabItem(value);
|
||||
protected override TabItem<Channel> CreateTabItem(Channel value) => value.Id == -1 ? new ChannelTabItem.ChannelSelectorTabItem(value) : new ChannelTabItem(value);
|
||||
|
||||
private const float shear_width = 10;
|
||||
|
||||
@ -37,6 +37,11 @@ namespace osu.Game.Overlays.Chat
|
||||
TextSize = 20,
|
||||
Padding = new MarginPadding(10),
|
||||
});
|
||||
|
||||
AddItem(new Channel
|
||||
{
|
||||
Id = ChatOverlay.CHANNEL_SELECTOR_ID,
|
||||
});
|
||||
}
|
||||
|
||||
private class ChannelTabItem : TabItem<Channel>
|
||||
@ -49,6 +54,7 @@ namespace osu.Game.Overlays.Chat
|
||||
private readonly SpriteText textBold;
|
||||
private readonly Box box;
|
||||
private readonly Box highlightBox;
|
||||
private readonly TextAwesome icon;
|
||||
|
||||
public override bool Active
|
||||
{
|
||||
@ -159,7 +165,7 @@ namespace osu.Game.Overlays.Chat
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new TextAwesome
|
||||
icon = new TextAwesome
|
||||
{
|
||||
Icon = FontAwesome.fa_hashtag,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
@ -191,6 +197,28 @@ namespace osu.Game.Overlays.Chat
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public class ChannelSelectorTabItem : ChannelTabItem
|
||||
{
|
||||
public ChannelSelectorTabItem(Channel value) : base(value)
|
||||
{
|
||||
Depth = float.MaxValue;
|
||||
Width = 60;
|
||||
|
||||
icon.Icon = FontAwesome.fa_plus;
|
||||
icon.X = 0;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private new void load(OsuColour colour)
|
||||
{
|
||||
backgroundActive = colour.Green;
|
||||
backgroundInactive = colour.GreenDark;
|
||||
backgroundHover = colour.Green;
|
||||
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
public const float TAB_AREA_HEIGHT = 50;
|
||||
|
||||
public const int CHANNEL_SELECTOR_ID = -1;
|
||||
|
||||
private GetMessagesRequest fetchReq;
|
||||
|
||||
private readonly ChatTabControl channelTabs;
|
||||
@ -262,6 +264,16 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
if (currentChannel == value) return;
|
||||
|
||||
if(value.Id == CHANNEL_SELECTOR_ID)
|
||||
{
|
||||
//channel selector popout
|
||||
currentChannel = value;
|
||||
return;
|
||||
}else if(currentChannel?.Id == CHANNEL_SELECTOR_ID)
|
||||
{
|
||||
//channel selector popin
|
||||
}
|
||||
|
||||
if (currentChannel != null)
|
||||
currentChannelContainer.Clear(false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user