1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 03:17:39 +08:00
osu-lazer/osu.Game/Overlays/Chat/Selection/ChannelSection.cs

65 lines
1.9 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 17:19:50 +08:00
using System;
2018-04-13 17:19:50 +08:00
using System.Collections.Generic;
using System.Linq;
2018-11-20 15:51:59 +08:00
using osuTK;
2018-04-13 17:19:50 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
2018-04-13 17:19:50 +08:00
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.Chat.Selection
2018-04-13 17:19:50 +08:00
{
public class ChannelSection : Container, IHasFilterableChildren
{
private readonly OsuSpriteText header;
public readonly FillFlowContainer<ChannelListItem> ChannelFlow;
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children;
public IEnumerable<string> FilterTerms => Array.Empty<string>();
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
public bool MatchingFilter
{
set => this.FadeTo(value ? 1f : 0f, 100);
2018-04-13 17:19:50 +08:00
}
2019-03-28 23:29:07 +08:00
public bool FilteringActive { get; set; }
2018-04-13 17:19:50 +08:00
public string Header
{
get => header.Text;
set => header.Text = value.ToUpperInvariant();
2018-04-13 17:19:50 +08:00
}
public IEnumerable<Channel> Channels
{
set => ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c));
2018-04-13 17:19:50 +08:00
}
public ChannelSection()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
header = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold),
2018-04-13 17:19:50 +08:00
},
ChannelFlow = new FillFlowContainer<ChannelListItem>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 25 },
Spacing = new Vector2(0f, 5f),
},
};
}
}
}