osu/osu.Game/Overlays/Chat/Selection/ChannelSection.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.7 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 09:19:50 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
using osuTK;
2018-04-13 09:19:50 +00:00
namespace osu.Game.Overlays.Chat.Selection
{
2017-05-20 23:22:55 +00:00
public class ChannelSection : Container, IHasFilterableChildren
{
public readonly FillFlowContainer<ChannelListItem> ChannelFlow;
2018-04-13 09:19:50 +00:00
2017-05-26 07:11:45 +00:00
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children;
public IEnumerable<string> FilterTerms => Array.Empty<string>();
2019-02-28 04:31:40 +00:00
2017-06-01 01:39:03 +00:00
public bool MatchingFilter
2017-05-26 06:46:50 +00:00
{
set => this.FadeTo(value ? 1f : 0f, 100);
2017-05-20 23:22:55 +00:00
}
2018-04-13 09:19:50 +00:00
2019-03-28 15:29:07 +00:00
public bool FilteringActive { get; set; }
public IEnumerable<Channel> Channels
{
set => ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c));
}
2018-04-13 09:19:50 +00:00
public ChannelSection()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
2018-04-13 09:19:50 +00:00
Children = new Drawable[]
{
2021-02-25 05:08:01 +00:00
new OsuSpriteText
{
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold),
Text = "All Channels".ToUpperInvariant()
},
ChannelFlow = new FillFlowContainer<ChannelListItem>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 25 },
Spacing = new Vector2(0f, 5f),
},
};
}
}
}