2017-05-21 05:29:57 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Online.Chat;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Chat
|
|
|
|
|
{
|
2017-05-21 07:22:55 +08:00
|
|
|
|
public class ChannelSection : Container, IHasFilterableChildren
|
2017-05-21 05:29:57 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly OsuSpriteText header;
|
|
|
|
|
|
2017-05-21 08:26:39 +08:00
|
|
|
|
public readonly FillFlowContainer<ChannelListItem> ChannelFlow;
|
|
|
|
|
|
2017-05-26 14:46:50 +08:00
|
|
|
|
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children.OfType<ChannelListItem>();
|
|
|
|
|
public string[] FilterTerms => new[] { Header };
|
|
|
|
|
public bool MatchingCurrentFilter
|
|
|
|
|
{
|
2017-05-21 08:26:39 +08:00
|
|
|
|
set
|
2017-05-26 14:46:50 +08:00
|
|
|
|
{
|
2017-05-21 07:22:55 +08:00
|
|
|
|
FadeTo(value ? 1f : 0f, 100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-21 05:29:57 +08:00
|
|
|
|
public string Header
|
|
|
|
|
{
|
2017-05-21 07:22:55 +08:00
|
|
|
|
get { return header.Text; }
|
|
|
|
|
set { header.Text = value; }
|
2017-05-21 05:29:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEnumerable<Channel> Channels
|
|
|
|
|
{
|
2017-05-21 08:26:39 +08:00
|
|
|
|
set { ChannelFlow.Children = value.Select(c => new ChannelListItem { Channel = c }); }
|
2017-05-21 05:29:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ChannelSection()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
header = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
TextSize = 15,
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
|
|
|
|
},
|
2017-05-21 08:26:39 +08:00
|
|
|
|
ChannelFlow = new FillFlowContainer<ChannelListItem>
|
2017-05-21 05:29:57 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Margin = new MarginPadding { Top = 25 },
|
|
|
|
|
Spacing = new Vector2(0f, 5f),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|